shared repository - add a few missing calls to adjust_shared_perm().
There were a few calls to adjust_shared_perm() that were missing: - init-db creates refs, refs/heads, and refs/tags before reading from templates that could specify sharedrepository in the config file; - updating config file created it under user's umask without adjusting; - updating refs created it under user's umask without adjusting; - switching branches created .git/HEAD under user's umask without adjusting. This moves adjust_shared_perm() from sha1_file.c to path.c, since a few SIMPLE_PROGRAM need to call repository configuration functions which in turn need to call adjust_shared_perm(). sha1_file.c needs to link with SHA1 computation library which is usually not linked to SIMPLE_PROGRAM. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
15
lockfile.c
15
lockfile.c
@ -27,11 +27,16 @@ int hold_lock_file_for_update(struct lock_file *lk, const char *path)
|
||||
int fd;
|
||||
sprintf(lk->filename, "%s.lock", path);
|
||||
fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
|
||||
if (fd >=0 && !lk->next) {
|
||||
lk->next = lock_file_list;
|
||||
lock_file_list = lk;
|
||||
signal(SIGINT, remove_lock_file_on_signal);
|
||||
atexit(remove_lock_file);
|
||||
if (0 <= fd) {
|
||||
if (!lk->next) {
|
||||
lk->next = lock_file_list;
|
||||
lock_file_list = lk;
|
||||
signal(SIGINT, remove_lock_file_on_signal);
|
||||
atexit(remove_lock_file);
|
||||
}
|
||||
if (adjust_shared_perm(lk->filename))
|
||||
return error("cannot fix permission bits on %s",
|
||||
lk->filename);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
Reference in New Issue
Block a user