]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
xattr-util: drop unnecessary nofollow normalization
authorMike Yuan <me@yhndnzj.com>
Sun, 9 Feb 2025 21:56:00 +0000 (22:56 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 11 Feb 2025 15:57:56 +0000 (16:57 +0100)
Follow-up for b8df25dcfe674e37ceb3d54e00a31e1d33e96057

This is some leftover from get/listxattrat() usage which
got dropped later.

src/basic/xattr-util.c

index 411103b83e94876939c598555fb38694ef50a346..a43f795f0f24c4658ad1010ad61e05ec91a1c458 100644 (file)
@@ -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;