diff --git a/receive-pack.c b/receive-pack.c
index dfa7cd1d0a81eade8225e11dc0f2b97682a905c0..f39703f7af9ae809b144b0f074561756717bf04a 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
if (!has_sha1_file(new_sha1))
die("unpack should have generated %s, but I can't find it!", new_hex);
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));
if (newfd < 0)
die("unable to create %s (%s)", lock_name, strerror(errno));
/* chdir to the directory. If that fails, try appending ".git" */
if (chdir(dir) < 0) {
/* 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);
}
die("unable to cd to %s", dir);
}