summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLibravatar Clément Chigot <clement.chigot@atos.net>2019-04-25 07:01:56 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-04-25 17:49:44 +0900
commit400caafb2bb63712bb23cfa4d800261aab8e5cae (patch)
treeee1b449e160406742425b4c105497e4b3618c93c /Makefile
parentMakefile: use fileno macro work around on AIX (diff)
downloadtgif-400caafb2bb63712bb23cfa4d800261aab8e5cae.tar.xz
git-compat-util: work around for access(X_OK) under root
On AIX, access(X_OK) may succeed when run as root even if the execution isn't possible. This behavior is allowed by POSIX which says: ... for a process with appropriate privileges, an implementation may indicate success for X_OK even if execute permission is not granted to any user. It can lead hook programs to have their execution refused: git commit -m content fatal: cannot exec '.git/hooks/pre-commit': Permission denied Add NEED_ACCESS_ROOT_HANDLER in order to use an access helper function. It checks with stat if any executable flags is set when the current user is root. Signed-off-by: Clément Chigot <clement.chigot@atos.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c5240942f2..b5e2822d82 100644
--- a/Makefile
+++ b/Makefile
@@ -439,6 +439,9 @@ all::
#
# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
#
+# Define NEED_ACCESS_ROOT_HANDLER if access() under root may success for X_OK
+# even if execution permission isn't granted for any user.
+#
# Define PAGER_ENV to a SP separated VAR=VAL pairs to define
# default environment variables to be passed when a pager is spawned, e.g.
#
@@ -1815,6 +1818,11 @@ ifdef FILENO_IS_A_MACRO
COMPAT_OBJS += compat/fileno.o
endif
+ifdef NEED_ACCESS_ROOT_HANDLER
+ COMPAT_CFLAGS += -DNEED_ACCESS_ROOT_HANDLER
+ COMPAT_OBJS += compat/access.o
+endif
+
ifeq ($(TCLTK_PATH),)
NO_TCLTK = NoThanks
endif