Skip to content

Commit

Permalink
plugins: reduce log level LOG_ERR -> LOG_WARNING
Browse files Browse the repository at this point in the history
These plugins signal success and failure directly to the console, the
user should inspect syslog for more information.

This change is a follow-up to 340cae4, where kernel logs of LOG_ERR and
higher are allowed to log directly to the console.  Since syslogd has
not been started before these plugins, the log messages would otherwise
leak to the console.

Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Nov 3, 2024
1 parent 6f08708 commit e99ac59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions plugins/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void file_save(void)
return;

if ((rc = time_get(&tm))) {
logit(LOG_ERR, "System clock invalid, before %s, not saving", rtc_timestamp);
logit(LOG_WARNING, "System clock invalid, before %s, not saving", rtc_timestamp);
print_desc(NULL, "System clock invalid, skipping");
} else {
char buf[32] = { 0 };
Expand Down Expand Up @@ -245,7 +245,7 @@ static void rtc_save(void *arg)
}

if (rc && errno == EINVAL) {
logit(LOG_ERR, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
logit(LOG_WARNING, "System clock invalid, before %s, not saving to RTC", rtc_timestamp);
rc = 2;
}

Expand Down Expand Up @@ -282,13 +282,13 @@ static void rtc_restore(void *arg)
}

if (rc) {
logit(LOG_ERR, "Failed restoring system clock from RTC.");
logit(LOG_WARNING, "Failed restoring system clock from RTC.");
if (EINVAL == errno)
logit(LOG_ERR, "RTC time is too old (before %s)", rtc_timestamp);
logit(LOG_WARNING, "RTC time is too old (before %s)", rtc_timestamp);
else if (ENOENT == errno)
logit(LOG_ERR, "RTC has no previously saved (valid) time.");
logit(LOG_WARNING, "RTC has no previously saved (valid) time.");
else
logit(LOG_ERR, "RTC error code %d: %s", errno, strerror(errno));
logit(LOG_WARNING, "RTC error code %d: %s", errno, strerror(errno));

time_set(NULL);
rc = 2;
Expand All @@ -313,7 +313,7 @@ PLUGIN_INIT(plugin_init)
struct tm tm = { 0 };

if (!strptime(rtc_timestamp, RTC_FMT, &tm)) {
logit(LOG_ERR, "Invalid restore date '%s', reverting to '%s'",
logit(LOG_WARNING, "Invalid restore date '%s', reverting to '%s'",
rtc_timestamp, RTC_TIMESTAMP_BEGIN_2000);
rtc_timestamp = RTC_TIMESTAMP_BEGIN_2000;
} else
Expand Down
2 changes: 1 addition & 1 deletion plugins/urandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static void setup(void *arg)
close(fd);
free(rpi);
if (rc < 0)
logit(LOG_ERR, "Failed adding entropy to kernel random pool: %s", strerror(err));
logit(LOG_WARNING, "Failed adding entropy to kernel random pool: %s", strerror(err));
print_result(rc < 0);
return;
fallback:
Expand Down

0 comments on commit e99ac59

Please sign in to comment.