X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=receive-pack.c;h=f39703f7af9ae809b144b0f074561756717bf04a;hb=c1c774e7965ba08061c3fc7bc57aebc7eeb6b40f;hp=d05f7d5ec42a088b29d3cac14d42b416013aedf7;hpb=944d858969e4e14adefdd8f21fac5c8ab45f83f7;p=git.git diff --git a/receive-pack.c b/receive-pack.c index d05f7d5e..f39703f7 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -25,7 +25,7 @@ struct command { char ref_name[0]; }; -struct command *commands = NULL; +static struct command *commands = NULL; static int is_all_zeroes(const char *hex) { @@ -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)); @@ -197,9 +197,7 @@ int main(int argc, char **argv) /* chdir to the directory. If that fails, try appending ".git" */ if (chdir(dir) < 0) { - static char path[PATH_MAX]; - snprintf(path, sizeof(path), "%s.git", dir); - if (chdir(path) < 0) + if (chdir(mkpath("%s.git", dir)) < 0) die("unable to cd to %s", dir); }