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.
This commit is contained in:
@ -54,7 +54,7 @@ static int create_file(const char *path, unsigned int mode)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
mode = (mode & 0100) ? 777 : 666;
|
mode = (mode & 0100) ? 0777 : 0666;
|
||||||
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
|
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == ENOENT) {
|
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);
|
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fd >= 0)
|
|
||||||
fchmod(fd, mode);
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user