]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
stat-util: add shortcut for fd_verify_symlink()
authorLennart Poettering <lennart@amutable.com>
Mon, 13 Apr 2026 08:41:01 +0000 (10:41 +0200)
committerLennart Poettering <lennart@amutable.com>
Mon, 13 Apr 2026 11:20:43 +0000 (13:20 +0200)
We have a similar shortcut in the other fd_verify_xyz() calls, let's add
it here too, just for completion's sake.

src/basic/stat-util.c

index 3e2d191bbbfb429de2f8ad98eeb8826f58050e49..3811bd019edb65125ba44024a785fdc31e9115fe 100644 (file)
@@ -145,6 +145,9 @@ int stat_verify_symlink(const struct stat *st) {
 }
 
 int fd_verify_symlink(int fd) {
+        if (IN_SET(fd, AT_FDCWD, XAT_FDROOT))
+                return -EISDIR;
+
         return verify_stat_at(fd, /* path= */ NULL, /* follow= */ false, stat_verify_symlink, /* verify= */ true);
 }