Skip to content

Commit

Permalink
[PATCH] Let umask do its work upon filesystem object creation.
Browse files Browse the repository at this point in the history
IIRC our strategy was to let the users' umask take care of the
final mode bits.  This patch fixes places that deviate from it.

Signed-off-by: Junio C Hamano <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Junio C Hamano authored and Linus Torvalds committed Jul 6, 2005
1 parent b2cb942 commit f312de0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ static void create_subdirectories(const char *path)
len = slash - path;
memcpy(buf, path, len);
buf[len] = 0;
if (mkdir(buf, 0755) < 0) {
if (mkdir(buf, 0777) < 0) {
if (errno != EEXIST)
break;
}
Expand Down
2 changes: 1 addition & 1 deletion csum-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct sha1file *sha1create(const char *fmt, ...)
die("you wascally wabbit, you");
f->namelen = len;

fd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0644);
fd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0666);
if (fd < 0)
die("unable to open %s (%s)", f->name, strerror(errno));
f->fd = fd;
Expand Down
4 changes: 2 additions & 2 deletions entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ static void create_directories(const char *path, struct checkout *state)
len = slash - path;
memcpy(buf, path, len);
buf[len] = 0;
if (mkdir(buf, 0755)) {
if (mkdir(buf, 0777)) {
if (errno == EEXIST) {
struct stat st;
if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0755))
if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
continue;
if (!stat(buf, &st) && S_ISDIR(st.st_mode))
continue; /* ok */
Expand Down
2 changes: 1 addition & 1 deletion init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

static void safe_create_dir(const char *dir)
{
if (mkdir(dir, 0755) < 0) {
if (mkdir(dir, 0777) < 0) {
if (errno != EEXIST) {
perror(dir);
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void update(const char *name, unsigned char *old_sha1, unsigned char *new
if (!has_sha1_file(new_sha1))
die("unpack should have generated %s, but I can't find it!", new_hex);

newfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0644);
newfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0666);
if (newfd < 0)
die("unable to create %s (%s)", lock_name, strerror(errno));

Expand Down

0 comments on commit f312de0

Please sign in to comment.