aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-01-13 18:22:46 +0100
committerJim Meyering <jim@meyering.net>2007-03-18 18:15:06 +0100
commit82d98da7431236987ccb0c5af034c2f12a44e1f3 (patch)
tree9cbe48b09dee1d878e44d914f2008215d275867f
parent* src/c99-to-c89.diff: Adjust offsets. (diff)
downloadcoreutils-82d98da7431236987ccb0c5af034c2f12a44e1f3.tar.gz
coreutils-82d98da7431236987ccb0c5af034c2f12a44e1f3.zip
* src/ls.c (gobble_file): Don't call getfilecon unless print_scontext.
Upon failed getfilecon, accept not just ENOTSUP, but also ENODATA.
-rw-r--r--ChangeLog-selinux3
-rw-r--r--src/ls.c7
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog-selinux b/ChangeLog-selinux
index 79a2304b8..2ef22cef2 100644
--- a/ChangeLog-selinux
+++ b/ChangeLog-selinux
@@ -1,5 +1,8 @@
2007-01-13 Jim Meyering <jim@meyering.net>
+ * src/ls.c (gobble_file): Don't call getfilecon unless print_scontext.
+ Upon failed getfilecon, accept not just ENOTSUP, but also ENODATA.
+
* src/c99-to-c89.diff: Adjust offsets.
* AUTHORS: Add chcon.
diff --git a/src/ls.c b/src/ls.c
index 66fb02a31..d421ce246 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2596,6 +2596,8 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
)))))
{
+ /* FIXME-c99: move this decl "down", once ls.c stabilizes. */
+ bool file_has_security_context = false;
/* Absolute name of this file. */
char *absolute_name;
bool do_deref;
@@ -2645,8 +2647,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
break;
}
- bool file_has_security_context = false;
- if (err == 0 && (format == long_format || print_scontext))
+ if (err == 0 && print_scontext)
{
int attr_len = (do_deref
? getfilecon (absolute_name, &f->scontext)
@@ -2658,7 +2659,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 (err && errno == ENOTSUP)
+ if (err && (errno == ENOTSUP || errno == ENODATA))
err = 0;
}