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/udev/udev-watch.c | |
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/udev/udev-watch.c')
-rw-r--r-- | src/udev/udev-watch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 061bd05875..6ba8674d77 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -39,7 +39,7 @@ static int inotify_fd = -1; int udev_watch_init(struct udev *udev) { inotify_fd = inotify_init1(IN_CLOEXEC); if (inotify_fd < 0) - log_error("inotify_init failed: %m"); + log_error_errno(errno, "inotify_init failed: %m"); return inotify_fd; } @@ -56,7 +56,7 @@ void udev_watch_restore(struct udev *udev) { dir = opendir("/run/udev/watch.old"); if (dir == NULL) { - log_error("unable to open old watches dir /run/udev/watch.old; old watches will not be restored: %m"); + log_error_errno(errno, "unable to open old watches dir /run/udev/watch.old; old watches will not be restored: %m"); return; } @@ -88,7 +88,7 @@ unlink: rmdir("/run/udev/watch.old"); } else if (errno != ENOENT) { - log_error("unable to move watches dir /run/udev/watch; old watches will not be restored: %m"); + log_error_errno(errno, "unable to move watches dir /run/udev/watch; old watches will not be restored: %m"); } } @@ -103,7 +103,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) { log_debug("adding watch on '%s'", udev_device_get_devnode(dev)); wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); if (wd < 0) { - log_error("inotify_add_watch(%d, %s, %o) failed: %m", + log_error_errno(errno, "inotify_add_watch(%d, %s, %o) failed: %m", inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); return; } @@ -113,7 +113,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) { unlink(filename); r = symlink(udev_device_get_id_filename(dev), filename); if (r < 0) - log_error("Failed to create symlink %s: %m", filename); + log_error_errno(errno, "Failed to create symlink %s: %m", filename); udev_device_set_watch_handle(dev, wd); } |