提交 fa06d442 编写于 作者: L Linus Torvalds

Fix total permission bogosity in "checkout-cache.c".

Use the proper octal mode naming instead of random decimal
crud, and don't reset the mode after the create with fchmod:
the whole point was to let "umask" do its thing.

Duh.
上级 c4e3cca1
......@@ -54,7 +54,7 @@ static int create_file(const char *path, unsigned int mode)
{
int fd;
mode = (mode & 0100) ? 777 : 666;
mode = (mode & 0100) ? 0777 : 0666;
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
if (fd < 0) {
if (errno == ENOENT) {
......@@ -62,8 +62,6 @@ static int create_file(const char *path, unsigned int mode)
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
}
}
if (fd >= 0)
fchmod(fd, mode);
return fd;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册