]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: fix security context indication in --long mode
authorPádraig Brady <P@draigBrady.com>
Mon, 11 Nov 2024 18:55:19 +0000 (18:55 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 11 Nov 2024 18:55:19 +0000 (18:55 +0000)
* src/ls.c (gobble_file): Always get the security context with -l
so that we can indicate a context with '.' if present.

src/ls.c

index 6ff0f410f29313f7591ea0ee692f605a719606a3..6422022d26aa28ea29c67be290164b5bf2a71776 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3501,8 +3501,9 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
   if ((format == long_format) | print_scontext | check_capability)
     {
       struct aclinfo ai;
+      bool get_scontext = (format == long_format) | print_scontext;
       int aclinfo_flags = ((do_deref ? ACL_SYMLINK_FOLLOW : 0)
-                           | (print_scontext ? ACL_GET_SCONTEXT : 0)
+                           | (get_scontext ? ACL_GET_SCONTEXT : 0)
                            | filetype_d_type[type]);
       int n = file_has_aclinfo_cache (full_name, f, &ai, aclinfo_flags);
       bool have_acl = 0 < n;