]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: refactor gobble_file get_scontext
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 15 Nov 2024 01:35:49 +0000 (17:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 15 Nov 2024 01:36:47 +0000 (17:36 -0800)
* src/ls.c (gobble_file): Simplify by pulling get_scontext
out of ‘if’.

src/ls.c

index 6422022d26aa28ea29c67be290164b5bf2a71776..5003608b4dfe21a16653b21864e5e274d98e86a2 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3496,12 +3496,12 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
   if (type == directory && command_line_arg && !immediate_dirs)
     f->filetype = type = arg_directory;
 
+  bool get_scontext = (format == long_format) | print_scontext;
   bool check_capability = format_needs_capability & (type == normal);
 
-  if ((format == long_format) | print_scontext | check_capability)
+  if (get_scontext | check_capability)
     {
       struct aclinfo ai;
-      bool get_scontext = (format == long_format) | print_scontext;
       int aclinfo_flags = ((do_deref ? ACL_SYMLINK_FOLLOW : 0)
                            | (get_scontext ? ACL_GET_SCONTEXT : 0)
                            | filetype_d_type[type]);