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/journal/journald-server.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/journal/journald-server.c')
-rw-r--r-- | src/journal/journald-server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 3d1947f25f..081ae7c08d 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -212,7 +212,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) { acl = acl_get_fd(f->fd); if (!acl) { - log_warning("Failed to read ACL on %s, ignoring: %m", f->path); + log_warning_errno(errno, "Failed to read ACL on %s, ignoring: %m", f->path); return; } @@ -222,7 +222,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) { if (acl_create_entry(&acl, &entry) < 0 || acl_set_tag_type(entry, ACL_USER) < 0 || acl_set_qualifier(entry, &uid) < 0) { - log_warning("Failed to patch ACL on %s, ignoring: %m", f->path); + log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path); goto finish; } } @@ -232,12 +232,12 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) { if (acl_get_permset(entry, &permset) < 0 || acl_add_perm(permset, ACL_READ) < 0 || calc_acl_mask_if_needed(&acl) < 0) { - log_warning("Failed to patch ACL on %s, ignoring: %m", f->path); + log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path); goto finish; } if (acl_set_fd(f->fd, acl) < 0) - log_warning("Failed to set ACL on %s, ignoring: %m", f->path); + log_warning_errno(errno, "Failed to set ACL on %s, ignoring: %m", f->path); finish: acl_free(acl); @@ -1174,7 +1174,7 @@ int process_datagram(sd_event_source *es, int fd, uint32_t revents, void *userda if (errno == EINTR || errno == EAGAIN) return 0; - log_error("recvmsg() failed: %m"); + log_error_errno(errno, "recvmsg() failed: %m"); return -errno; } @@ -1432,7 +1432,7 @@ static int server_open_hostname(Server *s) { s->hostname_fd = open("/proc/sys/kernel/hostname", O_RDONLY|O_CLOEXEC|O_NDELAY|O_NOCTTY); if (s->hostname_fd < 0) { - log_error("Failed to open /proc/sys/kernel/hostname: %m"); + log_error_errno(errno, "Failed to open /proc/sys/kernel/hostname: %m"); return -errno; } |