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/shared/watchdog.c | |
parent | core: fix return value in error path after sd_event_add_io() failure (diff) | |
download | systemd-56f64d95763a799ba4475daf44d8e9f72a1bd474.tar.xz systemd-56f64d95763a799ba4475daf44d8e9f72a1bd474.zip |
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/shared/watchdog.c')
-rw-r--r-- | src/shared/watchdog.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 7d188d98e8..386751418e 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -45,7 +45,7 @@ static int update_timeout(void) { flags = WDIOS_DISABLECARD; r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); if (r < 0) { - log_warning("Failed to disable hardware watchdog: %m"); + log_warning_errno(errno, "Failed to disable hardware watchdog: %m"); return -errno; } } else { @@ -55,7 +55,7 @@ static int update_timeout(void) { sec = (int) ((watchdog_timeout + USEC_PER_SEC - 1) / USEC_PER_SEC); r = ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec); if (r < 0) { - log_warning("Failed to set timeout to %is: %m", sec); + log_warning_errno(errno, "Failed to set timeout to %is: %m", sec); return -errno; } @@ -65,13 +65,13 @@ static int update_timeout(void) { flags = WDIOS_ENABLECARD; r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); if (r < 0) { - log_warning("Failed to enable hardware watchdog: %m"); + log_warning_errno(errno, "Failed to enable hardware watchdog: %m"); return -errno; } r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); if (r < 0) { - log_warning("Failed to ping hardware watchdog: %m"); + log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); return -errno; } } @@ -128,7 +128,7 @@ int watchdog_ping(void) { r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); if (r < 0) { - log_warning("Failed to ping hardware watchdog: %m"); + log_warning_errno(errno, "Failed to ping hardware watchdog: %m"); return -errno; } @@ -148,7 +148,7 @@ void watchdog_close(bool disarm) { flags = WDIOS_DISABLECARD; r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); if (r < 0) - log_warning("Failed to disable hardware watchdog: %m"); + log_warning_errno(errno, "Failed to disable hardware watchdog: %m"); /* To be sure, use magic close logic, too */ for (;;) { @@ -158,7 +158,7 @@ void watchdog_close(bool disarm) { break; if (errno != EINTR) { - log_error("Failed to disarm watchdog timer: %m"); + log_error_errno(errno, "Failed to disarm watchdog timer: %m"); break; } } |