summaryrefslogtreecommitdiff
path: root/src/basic/fileio.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-02 13:34:05 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:28 +0100
commit125fbe8768402f5d5ff52f273a6966c5864397a7 (patch)
tree9de0336926201003734e574b6dc0d9d865076ada /src/basic/fileio.c
parent170b60b25b486805483c25a47ac85a6adf526084 (diff)
fileio: fix error propagation in link_tmpfile()
(cherry picked from commit eaa680c09e5701a62e8ac819211e5969eda84f2d)
Diffstat (limited to 'src/basic/fileio.c')
-rw-r--r--src/basic/fileio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 7b1014b1d..026926980 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -1499,6 +1499,7 @@ int open_serialization_fd(const char *ident) {
#if 0 /// UNNEEDED by elogind
int link_tmpfile(int fd, const char *path, const char *target) {
+ int r;
assert(fd >= 0);
assert(target);
@@ -1511,8 +1512,9 @@ int link_tmpfile(int fd, const char *path, const char *target) {
* operation currently (renameat2() does), and there is no nice way to emulate this. */
if (path) {
- if (rename_noreplace(AT_FDCWD, path, AT_FDCWD, target) < 0)
- return -errno;
+ r = rename_noreplace(AT_FDCWD, path, AT_FDCWD, target);
+ if (r < 0)
+ return r;
} else {
char proc_fd_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(fd) + 1];