mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
reftable: don't second-guess errors from flock interface
The `flock` interface is implemented as part of "reftable/system.c" and thus needs to be implemented by the integrator between the reftable library and its parent code base. As such, we cannot rely on any specific implementation thereof. Regardless of that, users of the `flock` subsystem rely on `errno` being set to specific values. This is fragile and not documented anywhere and doesn't really make for a good interface. Refactor the code so that the implementations themselves are expected to return reftable-specific error codes. Our implementation of the `flock` subsystem already knows to do this for all error paths except one. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
54d25de3ea
commit
8fd7a0ebe1
@@ -72,7 +72,7 @@ int flock_acquire(struct reftable_flock *l, const char *target_path,
|
||||
reftable_free(lockfile);
|
||||
if (errno == EEXIST)
|
||||
return REFTABLE_LOCK_ERROR;
|
||||
return -1;
|
||||
return REFTABLE_IO_ERROR;
|
||||
}
|
||||
|
||||
l->fd = get_lock_file_fd(lockfile);
|
||||
|
||||
Reference in New Issue
Block a user