summaryrefslogtreecommitdiffstats
path: root/bin/ls
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-12-19 01:13:23 +0000
committertjr <tjr@FreeBSD.org>2002-12-19 01:13:23 +0000
commitc26513521a06d9a7ad0fd642c3de352135c495ea (patch)
treea7bcf931da461f61ac1339a7d05fb8624cecaa21 /bin/ls
parentb0df3e55167e4e27acf83a600ea83ad148670635 (diff)
downloadFreeBSD-src-c26513521a06d9a7ad0fd642c3de352135c495ea.zip
FreeBSD-src-c26513521a06d9a7ad0fd642c3de352135c495ea.tar.gz
pathconf() and acl_get_file() follow links so they cannot be used to
determine whether a symlink has an ACL. Instead, assume that symbolic links don't have ACLs and don't bother checking. Avoids spurious ENOENT warnings when listing directories containing broken symlinks on filesystems with ACLs enabled. Pointed out by: rwatson, bde
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/print.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 841270b..2fab63a 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -674,6 +674,14 @@ aclmode(char *buf, FTSENT *p, int *haveacls)
else
snprintf(name, sizeof(name), "%s/%s",
p->fts_parent->fts_accpath, p->fts_name);
+ /*
+ * We have no way to tell whether a symbolic link has an ACL since
+ * pathconf() and acl_get_file() both follow them.
+ */
+ if (S_ISLNK(p->fts_statp->st_mode)) {
+ *haveacls = 1;
+ return;
+ }
if ((ret = pathconf(name, _PC_ACL_EXTENDED)) <= 0) {
if (ret < 0 && errno != EINVAL)
warn("%s", name);
OpenPOWER on IntegriCloud