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/clean-ipc.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/shared/clean-ipc.c')
-rw-r--r-- | src/shared/clean-ipc.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index cb1722614e..39ab645133 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -44,7 +44,7 @@ static int clean_sysvipc_shm(uid_t delete_uid) { if (errno == ENOENT) return 0; - log_warning("Failed to open /proc/sysvipc/shm: %m"); + log_warning_errno(errno, "Failed to open /proc/sysvipc/shm: %m"); return -errno; } @@ -78,7 +78,7 @@ static int clean_sysvipc_shm(uid_t delete_uid) { if (errno == EIDRM || errno == EINVAL) continue; - log_warning("Failed to remove SysV shared memory segment %i: %m", shmid); + log_warning_errno(errno, "Failed to remove SysV shared memory segment %i: %m", shmid); ret = -errno; } } @@ -86,7 +86,7 @@ static int clean_sysvipc_shm(uid_t delete_uid) { return ret; fail: - log_warning("Failed to read /proc/sysvipc/shm: %m"); + log_warning_errno(errno, "Failed to read /proc/sysvipc/shm: %m"); return -errno; } @@ -101,7 +101,7 @@ static int clean_sysvipc_sem(uid_t delete_uid) { if (errno == ENOENT) return 0; - log_warning("Failed to open /proc/sysvipc/sem: %m"); + log_warning_errno(errno, "Failed to open /proc/sysvipc/sem: %m"); return -errno; } @@ -130,7 +130,7 @@ static int clean_sysvipc_sem(uid_t delete_uid) { if (errno == EIDRM || errno == EINVAL) continue; - log_warning("Failed to remove SysV semaphores object %i: %m", semid); + log_warning_errno(errno, "Failed to remove SysV semaphores object %i: %m", semid); ret = -errno; } } @@ -138,7 +138,7 @@ static int clean_sysvipc_sem(uid_t delete_uid) { return ret; fail: - log_warning("Failed to read /proc/sysvipc/sem: %m"); + log_warning_errno(errno, "Failed to read /proc/sysvipc/sem: %m"); return -errno; } @@ -153,7 +153,7 @@ static int clean_sysvipc_msg(uid_t delete_uid) { if (errno == ENOENT) return 0; - log_warning("Failed to open /proc/sysvipc/msg: %m"); + log_warning_errno(errno, "Failed to open /proc/sysvipc/msg: %m"); return -errno; } @@ -183,7 +183,7 @@ static int clean_sysvipc_msg(uid_t delete_uid) { if (errno == EIDRM || errno == EINVAL) continue; - log_warning("Failed to remove SysV message queue %i: %m", msgid); + log_warning_errno(errno, "Failed to remove SysV message queue %i: %m", msgid); ret = -errno; } } @@ -191,7 +191,7 @@ static int clean_sysvipc_msg(uid_t delete_uid) { return ret; fail: - log_warning("Failed to read /proc/sysvipc/msg: %m"); + log_warning_errno(errno, "Failed to read /proc/sysvipc/msg: %m"); return -errno; } @@ -211,7 +211,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning("Failed to stat() POSIX shared memory segment %s: %m", de->d_name); + log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name); ret = -errno; continue; } @@ -225,7 +225,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { kid = xopendirat(dirfd(dir), de->d_name, O_NOFOLLOW|O_NOATIME); if (!kid) { if (errno != ENOENT) { - log_warning("Failed to enter shared memory directory %s: %m", de->d_name); + log_warning_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name); ret = -errno; } } else { @@ -239,7 +239,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning("Failed to remove POSIX shared memory directory %s: %m", de->d_name); + log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name); ret = -errno; } } else { @@ -249,7 +249,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning("Failed to remove POSIX shared memory segment %s: %m", de->d_name); + log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %m", de->d_name); ret = -errno; } } @@ -258,7 +258,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { return ret; fail: - log_warning("Failed to read /dev/shm: %m"); + log_warning_errno(errno, "Failed to read /dev/shm: %m"); return -errno; } @@ -270,7 +270,7 @@ static int clean_posix_shm(uid_t uid) { if (errno == ENOENT) return 0; - log_warning("Failed to open /dev/shm: %m"); + log_warning_errno(errno, "Failed to open /dev/shm: %m"); return -errno; } @@ -287,7 +287,7 @@ static int clean_posix_mq(uid_t uid) { if (errno == ENOENT) return 0; - log_warning("Failed to open /dev/mqueue: %m"); + log_warning_errno(errno, "Failed to open /dev/mqueue: %m"); return -errno; } @@ -302,7 +302,7 @@ static int clean_posix_mq(uid_t uid) { if (errno == ENOENT) continue; - log_warning("Failed to stat() MQ segment %s: %m", de->d_name); + log_warning_errno(errno, "Failed to stat() MQ segment %s: %m", de->d_name); ret = -errno; continue; } @@ -317,7 +317,7 @@ static int clean_posix_mq(uid_t uid) { if (errno == ENOENT) continue; - log_warning("Failed to unlink POSIX message queue %s: %m", fn); + log_warning_errno(errno, "Failed to unlink POSIX message queue %s: %m", fn); ret = -errno; } } @@ -325,7 +325,7 @@ static int clean_posix_mq(uid_t uid) { return ret; fail: - log_warning("Failed to read /dev/mqueue: %m"); + log_warning_errno(errno, "Failed to read /dev/mqueue: %m"); return -errno; } |