diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-07-30 14:52:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-03 10:16:06 -0700 |
commit | e193c10fc4f9274d1e751cfcdcc4507818e8d498 (patch) | |
tree | b21ccb15cece377bc9f34044c71f4197be36609a | |
parent | 167e0c6d205ed785cc17b96e22d9366accfa1665 (diff) | |
download | git-e193c10fc4f9274d1e751cfcdcc4507818e8d498.tar.gz |
refs.c: return error instead of dying when locking fails during transaction
Change lock_ref_sha1_basic to return an error instead of dying when
we fail to lock a file during a transaction.
This function is only called from transaction_commit() and it knows how
to handle these failures.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -2209,6 +2209,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, lflags); if (lock->lock_fd < 0) { + last_errno = errno; if (errno == ENOENT && --attempts_remaining > 0) /* * Maybe somebody just deleted one of the @@ -2216,8 +2217,10 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, * again: */ goto retry; - else - unable_to_lock_index_die(ref_file, errno); + else { + unable_to_lock_error(ref_file, errno); + goto error_return; + } } if (bad_ref) return lock; |