summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-02-26 15:20:00 +0000
committerJim Meyering <jim@meyering.net>2002-02-26 15:20:00 +0000
commitd678a9231cf819287cea9fbfdd1fe7ce8c3820df (patch)
tree094ff063859bb44242a15b3d1c95fb3af293dcda /src
parentd936975f34ef7e230f4cbd72da7260fbd8a43384 (diff)
downloadcoreutils-d678a9231cf819287cea9fbfdd1fe7ce8c3820df.tar.xz
Include "acl.h" rather than <sys/acl.h>.
(USE_ACL): Remove; replaced by HAVE_ACL everywhere. (gobble_file): Use file_has_acl rather than doing it ourselves.
Diffstat (limited to 'src')
-rw-r--r--src/ls.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/ls.c b/src/ls.c
index 9dd2868ea..5d522840a 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -60,10 +60,6 @@
# include <sys/ptem.h>
#endif
-#if HAVE_SYS_ACL_H
-# include <sys/acl.h>
-#endif
-
#include <stdio.h>
#include <assert.h>
#include <setjmp.h>
@@ -107,6 +103,7 @@ int wcwidth ();
#include "system.h"
#include <fnmatch.h>
+#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)