summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-07 18:53:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-07 18:53:14 (GMT)
commite3172d80d5c527048d67310692a8a62efc2c01e5 (patch)
tree31abfc9e1153412685f4a7b63be164bc6935b5cc
parent792f0e7d1a156379fb71deb2e65c349c595a9202 (diff)
parent81a24b52c164b96d37c8c50799a624e2e8ce8a57 (diff)
downloadgit-e3172d80d5c527048d67310692a8a62efc2c01e5.zip
git-e3172d80d5c527048d67310692a8a62efc2c01e5.tar.gz
git-e3172d80d5c527048d67310692a8a62efc2c01e5.tar.bz2
Merge branch 'ar/sgid-bsd'
* ar/sgid-bsd: Do not use GUID on dir in git init --shared=all on FreeBSD
-rw-r--r--Makefile4
-rw-r--r--git-compat-util.h6
-rw-r--r--path.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ca5aad9..6e857e6 100644
--- a/Makefile
+++ b/Makefile
@@ -478,6 +478,7 @@ ifeq ($(uname_S),FreeBSD)
NO_MEMMEM = YesPlease
BASIC_CFLAGS += -I/usr/local/include
BASIC_LDFLAGS += -L/usr/local/lib
+ DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
endif
ifeq ($(uname_S),OpenBSD)
NO_STRCASESTR = YesPlease
@@ -747,6 +748,9 @@ ifdef THREADED_DELTA_SEARCH
EXTLIBS += -lpthread
LIB_OBJS += thread-utils.o
endif
+ifdef DIR_HAS_BSD_GROUP_SEMANTICS
+ COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
+endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
diff --git a/git-compat-util.h b/git-compat-util.h
index 2a40703..5912443 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -437,4 +437,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
#define qsort git_qsort
#endif
+#ifndef DIR_HAS_BSD_GROUP_SEMANTICS
+# define FORCE_DIR_SET_GID S_ISGID
+#else
+# define FORCE_DIR_SET_GID 0
+#endif
+
#endif
diff --git a/path.c b/path.c
index af27161..f4ed979 100644
--- a/path.c
+++ b/path.c
@@ -283,7 +283,7 @@ int adjust_shared_perm(const char *path)
? (S_IXGRP|S_IXOTH)
: 0));
if (S_ISDIR(mode))
- mode |= S_ISGID;
+ mode |= FORCE_DIR_SET_GID;
if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
return -2;
return 0;