From: Lennart Poettering Date: Mon, 22 Aug 2022 09:35:43 +0000 (+0200) Subject: chase-symlinks: fix shortcut condition X-Git-Tag: v252-rc1~377^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=37b9bc56fc8a1baecce68a8809034d6e387fd706;p=thirdparty%2Fsystemd.git chase-symlinks: fix shortcut condition --- diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c index ab80e766885..2561da0e8c1 100644 --- a/src/basic/chase-symlinks.c +++ b/src/basic/chase-symlinks.c @@ -505,7 +505,7 @@ int chase_symlinks_and_stat( if (chase_flags & CHASE_NONEXISTENT) return -EINVAL; - if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0) { + if (empty_or_root(root) && !ret_path && (chase_flags & (CHASE_NO_AUTOFS|CHASE_SAFE)) == 0 && !ret_fd) { /* Shortcut this call if none of the special features of this call are requested */ if (fstatat(AT_FDCWD, path, ret_stat, FLAGS_SET(chase_flags, CHASE_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0) < 0)