提交 fe732ede 编写于 作者: J Junio C Hamano

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: NJunio C Hamano <junkio@cox.net>
上级 49b8b292
......@@ -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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册