]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: fix spurious output with -Z
authorPádraig Brady <P@draigBrady.com>
Thu, 3 Oct 2024 14:15:48 +0000 (15:15 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 3 Oct 2024 14:17:17 +0000 (15:17 +0100)
* src/ls.c (gobble_file): Only output an error if there actually
was an error.

src/ls.c

index 101ffa81825484675689d6557270c21ce53db6b6..290ce35d24b0c091ee94abaf8bcd86b72550a1c7 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -3518,7 +3518,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
              ls fail just because the file (even a command line argument)
              isn't on the right type of file system.  I.e., a getfilecon
              failure isn't in the same class as a stat failure.  */
-          if (print_scontext
+          if (print_scontext && ai.scontext_err
               && (! (is_ENOTSUP (ai.scontext_err)
                      || ai.scontext_err == ENODATA)))
             error (0, ai.scontext_err, "%s", quotef (full_name));