diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-11-14 22:40:49 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-11-16 08:04:09 +0100 |
commit | 7c248223ebafb9bfde9af978cd1ccfc57dcced26 (patch) | |
tree | 228bcda6699a2ae88ad01fd1f5f024f2b5d7b0a0 /src/tmpfiles | |
parent | ef470ffa234c8c824897488195fb2fc9a4a520e6 (diff) | |
download | systemd-7c248223ebafb9bfde9af978cd1ccfc57dcced26.tar.gz |
tree-wide: use new RET_NERRNO() helper at various places
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 56a332326f..d6206ffd6a 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2160,18 +2160,17 @@ static int mkdir_parents_rm_if_wrong_type(mode_t child_mode, const char *path) { /* rm_if_wrong_type_safe already logs errors. */ return r; - next_fd = openat(parent_fd, t, O_NOCTTY | O_CLOEXEC | O_DIRECTORY); + next_fd = RET_NERRNO(openat(parent_fd, t, O_NOCTTY | O_CLOEXEC | O_DIRECTORY)); if (next_fd < 0) { _cleanup_free_ char *parent_name = NULL; - r = -errno; (void) fd_get_path(parent_fd, &parent_name); - return log_error_errno(r, "Failed to open \"%s\" at \"%s\": %m", t, strnull(parent_name)); + return log_error_errno(next_fd, "Failed to open \"%s\" at \"%s\": %m", t, strnull(parent_name)); } - if (fstat(next_fd, &parent_st) < 0) { + r = RET_NERRNO(fstat(next_fd, &parent_st)); + if (r < 0) { _cleanup_free_ char *parent_name = NULL; - r = -errno; (void) fd_get_path(parent_fd, &parent_name); return log_error_errno(r, "Failed to stat \"%s\" at \"%s\": %m", t, strnull(parent_name)); } @@ -2309,7 +2308,7 @@ static int create_item(Item *i) { return log_error_errno(r, "rm -fr %s failed: %m", i->path); mac_selinux_create_file_prepare(i->path, S_IFLNK); - r = symlink(i->argument, i->path) < 0 ? -errno : 0; + r = RET_NERRNO(symlink(i->argument, i->path)); mac_selinux_create_file_clear(); } if (r < 0) |