diff options
author | Junio C Hamano <junkio@cox.net> | 2006-11-04 12:24:05 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-11-05 18:36:36 -0800 |
commit | fe732edee10f9b241c8df9b4ea081a4f33ad3968 (patch) | |
tree | 5ceabceaefd7d72d75f381ef7d872d63c6c4b83b | |
parent | 49b8b2926fdcc4322445f0a3bda459e81cd98e9a (diff) | |
download | git-fe732edee10f9b241c8df9b4ea081a4f33ad3968.tar.gz |
adjust_shared_perm: chmod() only when needed.
When widening permission for files and directories in a 'shared'
repository for a user with inappropriate umask() setting for
shared work, make sure we call chmod() only when we actually
need to.
The primary idea owes credit to Johannes.
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r-- | path.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -279,7 +279,7 @@ int adjust_shared_perm(const char *path) : 0)); if (S_ISDIR(mode)) mode |= S_ISGID; - if (chmod(path, mode) < 0) + if ((mode & st.st_mode) != mode && chmod(path, mode) < 0) return -2; return 0; } |