]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: CHASE_NOFOLLOW is not limited to CHASE_OPEN 13194/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Jul 2019 11:18:36 +0000 (13:18 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Jul 2019 13:29:11 +0000 (15:29 +0200)
$ build/test-chase-symlinks /etc/os-release
/etc/os-release → /usr/lib/os-release

$ build/test-chase-symlinks --nofollow /etc/os-release /etc/../etc/os-release /etc/../etc/./././os-release
/etc/os-release → /etc/os-release
/etc/../etc/os-release → /etc/os-release
/etc/../etc/./././os-release → /etc/os-release

src/basic/fs-util.h

index a35c3b6f3111c540067a5aea195357c899c64bd2..9a242ce3c5be6cd086a9737ddede6cd425d89555 100644 (file)
@@ -81,8 +81,9 @@ enum {
         CHASE_OPEN        = 1 << 4, /* Return an O_PATH object to the final component */
         CHASE_TRAIL_SLASH = 1 << 5, /* Any trailing slash will be preserved */
         CHASE_STEP        = 1 << 6, /* Just execute a single step of the normalization */
-        CHASE_NOFOLLOW    = 1 << 7, /* Only valid with CHASE_OPEN: when the path's right-most component refers to symlink,
-                                     * return O_PATH fd of the symlink, rather than following it. */
+        CHASE_NOFOLLOW    = 1 << 7, /* Do not follow the path's right-most compontent. With CHASE_OPEN, when
+                                     * the path's right-most component refers to symlink, return O_PATH fd of
+                                     * the symlink. */
         CHASE_WARN        = 1 << 8, /* Emit an appropriate warning when an error is encountered */
 };