bash-custom-action/bash-4.0.24-acl.dif

62 lines
2.0 KiB
Plaintext
Raw Normal View History

Index: findcmd.c
===================================================================
--- findcmd.c.orig
+++ findcmd.c
@@ -93,7 +93,22 @@ file_status (name)
r = FS_EXISTS;
-#if defined (AFS)
+#if defined (HAVE_EACCESS) /* FreeBSD, GLIBC_2.4+ */
+
+ /* For support of ACL's use eaccess(3) if found e.g. glibc 2.4 and up:
+ * Like access(2), euidaccess(3) checks permissions and existence of the
+ * file identified by its argument pathname. However, whereas access(2),
+ * performs checks using the real user and group identifiers of the pro-
+ * cess, euidaccess(3) uses the effective identifiers.
+ * eaccess(3) is a synonym for euidaccess(3), provided for compatibility
+ * with some other systems. */
+ if (eaccess (name, X_OK) == 0)
+ r |= FS_EXECABLE;
+ if (eaccess (name, R_OK) == 0)
+ r |= FS_READABLE;
+
+#elif defined (AFS)
+
/* We have to use access(2) to determine access because AFS does not
support Unix file system semantics. This may produce wrong
answers for non-AFS files when ruid != euid. I hate AFS. */
@@ -102,8 +117,7 @@ file_status (name)
if (access (name, R_OK) == 0)
r |= FS_READABLE;
- return r;
-#else /* !AFS */
+#else /* !AFS && !HAVE_EACCESS */
/* Find out if the file is actually executable. By definition, the
only other criteria is that the file has an execute bit set that
@@ -146,8 +160,8 @@ file_status (name)
r |= FS_READABLE;
}
+#endif /* !AFS && !HAVE_EACCESS */
return r;
-#endif /* !AFS */
}
/* Return non-zero if FILE exists and is executable.
Index: lib/sh/eaccess.c
===================================================================
--- lib/sh/eaccess.c.orig
+++ lib/sh/eaccess.c
@@ -201,7 +201,7 @@ sh_eaccess (path, mode)
if (path_is_devfd (path))
return (sh_stataccess (path, mode));
-#if defined (HAVE_EACCESS) /* FreeBSD */
+#if defined (HAVE_EACCESS) /* FreeBSD, GLIBC_2.4+ */
return (eaccess (path, mode));
#elif defined (EFF_ONLY_OK) /* SVR4(?), SVR4.2 */
return access (path, mode|EFF_ONLY_OK);