From: Mike Yuan Date: Sun, 9 Feb 2025 21:56:00 +0000 (+0100) Subject: xattr-util: drop unnecessary nofollow normalization X-Git-Tag: v258-rc1~1360^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78b47a4e89a9b9aa3484571514ad7e252c4169af;p=thirdparty%2Fsystemd.git xattr-util: drop unnecessary nofollow normalization Follow-up for b8df25dcfe674e37ceb3d54e00a31e1d33e96057 This is some leftover from get/listxattrat() usage which got dropped later. --- diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c index 411103b83e9..a43f795f0f2 100644 --- a/src/basic/xattr-util.c +++ b/src/basic/xattr-util.c @@ -90,14 +90,13 @@ static int getxattr_pinned_internal( assert(!path || !isempty(path)); assert((fd >= 0) == !path); - assert((at_flags & ~(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH)) == 0); assert(path || FLAGS_SET(at_flags, AT_EMPTY_PATH)); assert(name); assert(buf || size == 0); if (path) - n = FLAGS_SET(at_flags, AT_SYMLINK_NOFOLLOW) ? lgetxattr(path, name, buf, size) - : getxattr(path, name, buf, size); + n = FLAGS_SET(at_flags, AT_SYMLINK_FOLLOW) ? getxattr(path, name, buf, size) + : lgetxattr(path, name, buf, size); else n = by_procfs ? getxattr(FORMAT_PROC_FD_PATH(fd), name, buf, size) : fgetxattr(fd, name, buf, size); @@ -141,8 +140,6 @@ int getxattr_at_malloc( if (r < 0) return r; - at_flags = at_flags_normalize_nofollow(at_flags); - size_t l = 100; for (unsigned n_attempts = 7;;) { _cleanup_free_ char *v = NULL; @@ -200,13 +197,12 @@ static int listxattr_pinned_internal( assert(!path || !isempty(path)); assert((fd >= 0) == !path); - assert((at_flags & ~(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH)) == 0); assert(path || FLAGS_SET(at_flags, AT_EMPTY_PATH)); assert(buf || size == 0); if (path) - n = FLAGS_SET(at_flags, AT_SYMLINK_NOFOLLOW) ? llistxattr(path, buf, size) - : listxattr(path, buf, size); + n = FLAGS_SET(at_flags, AT_SYMLINK_FOLLOW) ? listxattr(path, buf, size) + : llistxattr(path, buf, size); else n = by_procfs ? listxattr(FORMAT_PROC_FD_PATH(fd), buf, size) : flistxattr(fd, buf, size); @@ -236,8 +232,6 @@ int listxattr_at_malloc(int fd, const char *path, int at_flags, char **ret) { if (r < 0) return r; - at_flags = at_flags_normalize_nofollow(at_flags); - size_t l = 100; for (unsigned n_attempts = 7;;) { _cleanup_free_ char *v = NULL;