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>
Patrick Steinhardt committed
Aug 8, 2024 at 16:06 UTC
7ee307da1bfe3867f91fbd9a053494bc5fe61675
1 file changed
+5
-2
reftable/stack.c
+5
-2
@@ -674,8 +674,11 @@ int reftable_addition_commit(struct reftable_addition *add)
674
goto done;
675
}
676
677
- fsync_component_or_die(FSYNC_COMPONENT_REFERENCE, lock_file_fd,
678
- get_tempfile_path(add->lock_file));
677
+ err = fsync_component(FSYNC_COMPONENT_REFERENCE, lock_file_fd);
678
+ if (err < 0) {
679
+ err = REFTABLE_IO_ERROR;
680
+ goto done;
681
+ }
682
683
err = rename_tempfile(&add->lock_file, add->stack->list_file);
684
if (err < 0) {