diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-03-07 14:10:31 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-07 21:34:13 +0100 |
commit | 4ae540d421c5a763a14fbe79a35d6f6ca004a21b (patch) | |
tree | 1267a830243865edbca8e8b6a624035c56f83558 /lockfile.h | |
parent | The third batch (diff) | |
download | git-4ae540d421c5a763a14fbe79a35d6f6ca004a21b.tar.xz git-4ae540d421c5a763a14fbe79a35d6f6ca004a21b.zip |
lockfile: report when rollback fails
We do not report to the caller when rolling back a lockfile fails, which
will be needed by the reftable compaction logic in a subsequent commit.
It also cannot really report on all errors because the function calls
`delete_tempfile()`, which doesn't return an error either.
Refactor the code so that both `delete_tempfile()` and
`rollback_lock_file()` return an error code.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'lockfile.h')
-rw-r--r-- | lockfile.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lockfile.h b/lockfile.h index 90af4e66b2..1bb9926497 100644 --- a/lockfile.h +++ b/lockfile.h @@ -321,11 +321,11 @@ static inline int commit_lock_file_to(struct lock_file *lk, const char *path) * Roll back `lk`: close the file descriptor and/or file pointer and * remove the lockfile. It is a NOOP to call `rollback_lock_file()` * for a `lock_file` object that has already been committed or rolled - * back. + * back. No error will be returned in this case. */ -static inline void rollback_lock_file(struct lock_file *lk) +static inline int rollback_lock_file(struct lock_file *lk) { - delete_tempfile(&lk->tempfile); + return delete_tempfile(&lk->tempfile); } #endif /* LOCKFILE_H */ |