diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-07-28 09:51:47 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-08-18 22:49:48 +0200 |
commit | 3db99289c153b0a648c035d63c8b523f6d8f8e96 (patch) | |
tree | 0504851ab3757a935648d6bbbca829229bd987ee /src/shared | |
parent | 91f2048c4166a5669f8013ddd5f4150443518434 (diff) |
clean-ipc: shorten code a bit
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/clean-ipc.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c index 44b7e08ce8..95686348c1 100644 --- a/src/shared/clean-ipc.c +++ b/src/shared/clean-ipc.c @@ -217,8 +217,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name); - ret = -errno; + ret = log_warning_errno(errno, "Failed to stat() POSIX shared memory segment %s: %m", de->d_name); continue; } @@ -230,10 +229,8 @@ 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_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name); - ret = -errno; - } + if (errno != ENOENT) + ret = log_warning_errno(errno, "Failed to enter shared memory directory %s: %m", de->d_name); } else { r = clean_posix_shm_internal(kid, uid); if (r < 0) @@ -245,8 +242,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name); - ret = -errno; + ret = log_warning_errno(errno, "Failed to remove POSIX shared memory directory %s: %m", de->d_name); } } else { @@ -255,8 +251,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { if (errno == ENOENT) continue; - log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %m", de->d_name); - ret = -errno; + ret = log_warning_errno(errno, "Failed to remove POSIX shared memory segment %s: %m", de->d_name); } } } @@ -264,8 +259,7 @@ static int clean_posix_shm_internal(DIR *dir, uid_t uid) { return ret; fail: - log_warning_errno(errno, "Failed to read /dev/shm: %m"); - return -errno; + return log_warning_errno(errno, "Failed to read /dev/shm: %m"); } static int clean_posix_shm(uid_t uid) { |