Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-05 23:01:17 +0400
committerRussell Belfer <rb@github.com>2013-09-05 23:01:17 +0400
commitaf22dabb4366f8b2dd4acd5725a25e88842d6938 (patch)
tree91221d88877c7ca73d0373f6d42def58f21397db /src/fileops.h
parentc97d407d9cc54fc99af0a57e09e04e9e0bc68cb6 (diff)
GIT_MODE_TYPE should exclude setgid bits
The GIT_MODE_TYPE macro was looking at all bits above the permissions, but it should really just look at the top bits so that it will give the right results for a setgid or setuid entry. Since we're now using these macros in the tests, this was causing a test failure on platforms that don't support setgid.
Diffstat (limited to 'src/fileops.h')
-rw-r--r--src/fileops.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fileops.h b/src/fileops.h
index 142eb99d2..f2144566d 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -228,7 +228,8 @@ extern git_off_t git_futils_filesize(git_file fd);
#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_EXECUTABLE(MODE) ? 0777 : 0666)
#define GIT_MODE_PERMS_MASK 0777
-#define GIT_MODE_TYPE(MODE) ((MODE) & ~GIT_MODE_PERMS_MASK)
+#define GIT_MODE_TYPE_MASK 0170000
+#define GIT_MODE_TYPE(MODE) ((MODE) & GIT_MODE_TYPE_MASK)
#define GIT_MODE_ISBLOB(MODE) (GIT_MODE_TYPE(MODE) == GIT_MODE_TYPE(GIT_FILEMODE_BLOB))
/**