mirror of
https://github.com/git/git
synced 2024-10-28 19:25:47 +00:00
lockfile: unlock file if lockfile permissions cannot be adjusted
If the call to adjust_shared_perm() fails, lock_file returns -1, which to the caller looks like any other failure to lock the file. So in this case, roll back the lockfile before returning so that the lock file is deleted immediately and the lockfile object is left in a predictable state (namely, unlocked). Previously, the lockfile was retained until process cleanup in this situation. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
26f5d3b65f
commit
41dd4ffaf9
1 changed files with 1 additions and 0 deletions
|
@ -153,6 +153,7 @@ static int lock_file(struct lock_file *lk, const char *path, int flags)
|
|||
int save_errno = errno;
|
||||
error("cannot fix permission bits on %s",
|
||||
lk->filename);
|
||||
rollback_lock_file(lk);
|
||||
errno = save_errno;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue