diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:29:59 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 19:49:27 +0100 |
commit | 56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch) | |
tree | 4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/timesync | |
parent | 895b3a7b44fe7ca2f260986be2a877ff56a72718 (diff) |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments.
Diffstat (limited to 'src/timesync')
-rw-r--r-- | src/timesync/timesyncd-manager.c | 8 | ||||
-rw-r--r-- | src/timesync/timesyncd.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c index 670b122836..b16b25a96a 100644 --- a/src/timesync/timesyncd-manager.c +++ b/src/timesync/timesyncd-manager.c @@ -211,7 +211,7 @@ static int manager_send_request(Manager *m) { m->pending = true; log_debug("Sent NTP request to %s (%s).", strna(pretty), m->current_server_name->string); } else { - log_debug("Sending NTP request to %s (%s) failed: %m", strna(pretty), m->current_server_name->string); + log_debug_errno(errno, "Sending NTP request to %s (%s) failed: %m", strna(pretty), m->current_server_name->string); return manager_connect(m); } @@ -312,12 +312,12 @@ static int manager_clock_watch_setup(Manager *m) { m->clock_watch_fd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC); if (m->clock_watch_fd < 0) { - log_error("Failed to create timerfd: %m"); + log_error_errno(errno, "Failed to create timerfd: %m"); return -errno; } if (timerfd_settime(m->clock_watch_fd, TFD_TIMER_ABSTIME|TFD_TIMER_CANCEL_ON_SET, &its, NULL) < 0) { - log_error("Failed to set up timerfd: %m"); + log_error_errno(errno, "Failed to set up timerfd: %m"); return -errno; } @@ -682,7 +682,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re m->sync = true; r = manager_adjust_clock(m, offset, leap_sec); if (r < 0) - log_error("Failed to call clock_adjtime(): %m"); + log_error_errno(errno, "Failed to call clock_adjtime(): %m"); } log_info("interval/delta/delay/jitter/drift " USEC_FMT "s/%+.3fs/%.3fs/%.3fs/%+ippm%s", diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c index ed02e6db3a..f7e089fc0c 100644 --- a/src/timesync/timesyncd.c +++ b/src/timesync/timesyncd.c @@ -73,7 +73,7 @@ static int load_clock_timestamp(uid_t uid, gid_t gid) { format_timestamp(date, sizeof(date), min)); if (clock_settime(CLOCK_REALTIME, timespec_store(&ts, min)) < 0) - log_error("Failed to restore system clock: %m"); + log_error_errno(errno, "Failed to restore system clock: %m"); } return 0; |