From 1411a53dc12fe39c8217974bd36a2929952bacad Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 13 Jan 2007 18:22:46 +0100 Subject: * src/ls.c (gobble_file): Don't call getfilecon unless print_scontext. Upon failed getfilecon, accept not just ENOTSUP, but also ENODATA. --- src/ls.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ls.c b/src/ls.c index f8727a246..b33146ce4 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; } -- cgit v1.2.3-54-g00ecf