From d678a9231cf819287cea9fbfdd1fe7ce8c3820df Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 26 Feb 2002 15:20:00 +0000 Subject: [PATCH] Include "acl.h" rather than . (USE_ACL): Remove; replaced by HAVE_ACL everywhere. (gobble_file): Use file_has_acl rather than doing it ourselves. --- src/ls.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/ls.c b/src/ls.c index 9dd2868ea7..5d522840ab 100644 --- a/src/ls.c +++ b/src/ls.c @@ -60,10 +60,6 @@ # include #endif -#if HAVE_SYS_ACL_H -# include -#endif - #include #include #include @@ -107,6 +103,7 @@ int wcwidth (); #include "system.h" #include +#include "acl.h" #include "argmatch.h" #include "dirname.h" #include "dirfd.h" @@ -126,13 +123,6 @@ int wcwidth (); #include "xstrtol.h" #include "xreadlink.h" -/* Use access control lists only under all the following conditions. - Some systems (OSF4, Irix5, Irix6) have the acl function, but not - sys/acl.h or don't define the GETACLCNT macro. */ -#if HAVE_SYS_ACL_H && HAVE_ACL && defined GETACLCNT -# define USE_ACL 1 -#endif - #define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \ : (ls_mode == LS_MULTI_COL \ ? "dir" : "vdir")) @@ -242,14 +232,13 @@ struct fileinfo enum filetype filetype; -#if USE_ACL - /* For long listings, nonzero if the file has an access control list, - otherwise zero. */ - int have_acl; +#if HAVE_ACL + /* For long listings, true if the file has an access control list. */ + bool have_acl; #endif }; -#if USE_ACL +#if HAVE_ACL # define FILE_HAS_ACL(F) ((F)->have_acl) #else # define FILE_HAS_ACL(F) 0 @@ -2225,11 +2214,14 @@ gobble_file (const char *name, enum filetype type, int explicit_arg, return 0; } -#if USE_ACL +#if HAVE_ACL if (format == long_format) - files[files_index].have_acl = - (! S_ISLNK (files[files_index].stat.st_mode) - && 4 < acl (path, GETACLCNT, 0, NULL)); + { + int n = file_has_acl (path, &files[files_index].stat); + files[files_index].have_acl = (0 < n); + if (n < 0) + error (0, errno, "%s", quotearg_colon (path)); + } #endif if (S_ISLNK (files[files_index].stat.st_mode) -- 2.47.3