diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-12-01 07:39:05 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-12-01 07:39:05 -0500 |
commit | 761b969283f415df75efe2ffb772a62b23379222 (patch) | |
tree | 66b297fd3a52397122ba44d0e4eefbd40cc6e160 /src/udev/udev-event.c | |
parent | ed7c6787bd009fb3e16fac6cccb6c0eb2fe7705e (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.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-event.c')
-rw-r--r-- | src/udev/udev-event.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index afcf262ebb..5c1352b1b9 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -388,7 +388,7 @@ static int spawn_exec(struct udev_event *event, if (fd_stderr < 0) dup2(fd, STDERR_FILENO); } else - log_error("open /dev/null failed: %m"); + log_error_errno(errno, "open /dev/null failed: %m"); /* connect pipes to std{out,err} */ if (fd_stdout >= 0) { @@ -410,7 +410,7 @@ static int spawn_exec(struct udev_event *event, execve(argv[0], argv, envp); /* exec failed */ - log_error("failed to execute '%s' '%s': %m", argv[0], cmd); + log_error_errno(errno, "failed to execute '%s' '%s': %m", argv[0], cmd); return -errno; } @@ -438,14 +438,14 @@ static void spawn_read(struct udev_event *event, fd_ep = epoll_create1(EPOLL_CLOEXEC); if (fd_ep < 0) { - log_error("error creating epoll fd: %m"); + log_error_errno(errno, "error creating epoll fd: %m"); return; } if (fd_stdout >= 0) { r = epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe); if (r < 0) { - log_error("fail to add stdout fd to epoll: %m"); + log_error_errno(errno, "fail to add stdout fd to epoll: %m"); return; } } @@ -453,7 +453,7 @@ static void spawn_read(struct udev_event *event, if (fd_stderr >= 0) { r = epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe); if (r < 0) { - log_error("fail to add stderr fd to epoll: %m"); + log_error_errno(errno, "fail to add stderr fd to epoll: %m"); return; } } @@ -482,7 +482,7 @@ static void spawn_read(struct udev_event *event, if (fdcount < 0) { if (errno == EINTR) continue; - log_error("failed to poll: %m"); + log_error_errno(errno, "failed to poll: %m"); return; } else if (fdcount == 0) { log_error("timeout '%s'", cmd); @@ -528,7 +528,7 @@ static void spawn_read(struct udev_event *event, } else if (ev[i].events & EPOLLHUP) { r = epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL); if (r < 0) { - log_error("failed to remove fd from epoll: %m"); + log_error_errno(errno, "failed to remove fd from epoll: %m"); return; } *fd = -1; @@ -577,7 +577,7 @@ static int spawn_wait(struct udev_event *event, if (errno == EINTR) continue; err = -errno; - log_error("failed to poll: %m"); + log_error_errno(errno, "failed to poll: %m"); goto out; } if (fdcount == 0) { @@ -588,7 +588,7 @@ static int spawn_wait(struct udev_event *event, if (errno == EINTR) continue; err = -errno; - log_error("failed to poll: %m"); + log_error_errno(errno, "failed to poll: %m"); goto out; } if (fdcount == 0) { @@ -692,14 +692,14 @@ int udev_event_spawn(struct udev_event *event, if (result != NULL || log_get_max_level() >= LOG_INFO) { if (pipe2(outpipe, O_NONBLOCK) != 0) { err = -errno; - log_error("pipe failed: %m"); + log_error_errno(errno, "pipe failed: %m"); goto out; } } if (log_get_max_level() >= LOG_INFO) { if (pipe2(errpipe, O_NONBLOCK) != 0) { err = -errno; - log_error("pipe failed: %m"); + log_error_errno(errno, "pipe failed: %m"); goto out; } } @@ -736,7 +736,7 @@ int udev_event_spawn(struct udev_event *event, _exit(2 ); case -1: - log_error("fork of '%s' failed: %m", cmd); + log_error_errno(errno, "fork of '%s' failed: %m", cmd); err = -1; goto out; default: |