diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 18:51:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-08 18:51:17 +0000 |
commit | f8bdff40eb3060586a7a385e7879f519b9af7d51 (patch) | |
tree | 0581c838f37fefddfd6d880aea14159dd9479e93 /src/basic/fs-util.c | |
parent | Releasing progress-linux version 252.22-1~deb12u1progress7u1. (diff) | |
download | systemd-f8bdff40eb3060586a7a385e7879f519b9af7d51.tar.xz systemd-f8bdff40eb3060586a7a385e7879f519b9af7d51.zip |
Merging upstream version 252.23.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/basic/fs-util.c')
-rw-r--r-- | src/basic/fs-util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 6b757bd..d71c07c 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -118,7 +118,11 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char int readlinkat_malloc(int fd, const char *p, char **ret) { size_t l = PATH_MAX; - assert(p); + assert(fd >= 0 || fd == AT_FDCWD); + + if (fd < 0 && isempty(p)) + return -EISDIR; /* In this case, the fd points to the current working directory, and is + * definitely not a symlink. Let's return earlier. */ for (;;) { _cleanup_free_ char *c = NULL; @@ -128,7 +132,7 @@ int readlinkat_malloc(int fd, const char *p, char **ret) { if (!c) return -ENOMEM; - n = readlinkat(fd, p, c, l); + n = readlinkat(fd, strempty(p), c, l); if (n < 0) return -errno; |