Index: bin/ls/print.c =================================================================== --- bin/ls/print.c (revision 180487) +++ bin/ls/print.c (working copy) @@ -629,23 +629,30 @@ aclmode(char *buf, const FTSENT *p, int else snprintf(name, sizeof(name), "%s/%s", p->fts_parent->fts_accpath, p->fts_name); + + *haveacls = 1; + /* * We have no way to tell whether a symbolic link has an ACL since * pathconf() and acl_get_file() both follow them. They also don't * support whiteouts. */ - if (S_ISLNK(p->fts_statp->st_mode) || S_ISWHT(p->fts_statp->st_mode)) { - *haveacls = 1; + if (S_ISLNK(p->fts_statp->st_mode) || S_ISWHT(p->fts_statp->st_mode)) return; - } + if ((ret = pathconf(name, _PC_ACL_EXTENDED)) <= 0) { + /* + * Only make assumptions about file system supporting ACLs on + * regular files or directories. UFS doesn't support ACLs for + * device files. + */ if (ret < 0 && errno != EINVAL) warn("%s", name); - else + else if (S_ISREG(p->fts_statp->st_mode) || + S_ISDIR(p->fts_statp->st_mode)) *haveacls = 0; return; } - *haveacls = 1; if ((facl = acl_get_file(name, ACL_TYPE_ACCESS)) != NULL) { if (acl_get_entry(facl, ACL_FIRST_ENTRY, &ae) == 1) { entries = 1; --- ls-haveacls-only-regular-files.diff ends here ---