aboutsummaryrefslogtreecommitdiff
path: root/reftable
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-08 16:06:44 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-08 10:14:43 -0700
commit7ee307da1bfe3867f91fbd9a053494bc5fe61675 (patch)
tree3bc041f69d9f8af9ce7caae0bc1c8d3b9de32cb5 /reftable
parent558f6fbeb1f194116231218b3e7496ceef4b9618 (diff)
downloadgit-7ee307da1bfe3867f91fbd9a053494bc5fe61675.tar.xz
reftable/stack: do not die when fsyncing lock file files
We use `fsync_component_or_die()` when committing an addition to the "tables.list" lock file, which unsurprisingly dies in case the fsync fails. Given that this is part of the reftable library, we should never die and instead let callers handle the error. Adapt accordingly and use `fsync_component()` instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable')
-rw-r--r--reftable/stack.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/reftable/stack.c b/reftable/stack.c
index 07e7ffc6b9..9ca549294f 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -674,8 +674,11 @@ int reftable_addition_commit(struct reftable_addition *add)
goto done;
}
- fsync_component_or_die(FSYNC_COMPONENT_REFERENCE, lock_file_fd,
- get_tempfile_path(add->lock_file));
+ err = fsync_component(FSYNC_COMPONENT_REFERENCE, lock_file_fd);
+ if (err < 0) {
+ err = REFTABLE_IO_ERROR;
+ goto done;
+ }
err = rename_tempfile(&add->lock_file, add->stack->list_file);
if (err < 0) {