Re: [PATCH 01/15] reftable/stack: fix error handling in `reftable_stack_init_addition()`
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Mar 20, 2024, 21:50 UTC
- Message-ID
- <CAOLa=ZQ5wFCqWZ4yjMzUg5Yz1UeVpwUap0z9Lx9EfRVKnzHttQ@mail.gmail.com>
- In-Reply-To
- <1e39d93a45db502280ecff383d53e0294f969719.1710706118.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 22 quoted lines
> diff --git a/reftable/stack.c b/reftable/stack.c
> index 1ecf1b9751..92d9a7facb 100644
> --- a/reftable/stack.c
> +++ b/reftable/stack.c
> @@ -590,8 +590,7 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
> err = stack_uptodate(st);
> if (err < 0)
> goto done;
> -
> - if (err > 1) {
> + if (err > 0) {
> err = REFTABLE_LOCK_ERROR;
> goto done;
> }
> @@ -713,10 +712,6 @@ static int stack_try_add(struct reftable_stack *st,
> int err = reftable_stack_init_addition(&add, st);
> if (err < 0)
> goto done;
> - if (err > 0) {
> - err = REFTABLE_LOCK_ERROR;
> - goto done;
> - }This changes the behavior though, since now we skip the `goto done`. It would be best to change the previous line to `if (err)`, which is what the other function (`reftable_stack_new_addition`) does.