diff mbox series

[v6,04/15] reftable: check reftable_stack_auto_compact() return value

Message ID 8740ba92981c77f85b855e69c237fdb7449cca58.1642691534.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit f7445865f260474082c8276dc2175ec23109c424
Headers show
Series Reftable coverity fixes | expand

Commit Message

Han-Wen Nienhuys Jan. 20, 2022, 3:12 p.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

Fixes a problem detected by Coverity.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 reftable/stack_test.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ævar Arnfjörð Bjarmason Jan. 21, 2022, 11:44 a.m. UTC | #1
On Thu, Jan 20 2022, Han-Wen Nienhuys via GitGitGadget wrote:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> Fixes a problem detected by Coverity.

Detected by coverity, but I think it's better to describe the
issue. Here it seems to be that we didn't use the "err" at all, so
before this change the test wasn't doing anything to check that we
didn't have an error?

Or would the subsequent EXPECT() catch it in practice?

> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  reftable/stack_test.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/reftable/stack_test.c b/reftable/stack_test.c
> index f4c743db80c..e84f50d27ff 100644
> --- a/reftable/stack_test.c
> +++ b/reftable/stack_test.c
> @@ -839,6 +839,7 @@ static void test_reftable_stack_auto_compaction(void)
>  		EXPECT_ERR(err);
>  
>  		err = reftable_stack_auto_compact(st);
> +		EXPECT_ERR(err);
>  		EXPECT(i < 3 || st->merged->stack_len < 2 * fastlog2(i));
>  	}
diff mbox series

Patch

diff --git a/reftable/stack_test.c b/reftable/stack_test.c
index f4c743db80c..e84f50d27ff 100644
--- a/reftable/stack_test.c
+++ b/reftable/stack_test.c
@@ -839,6 +839,7 @@  static void test_reftable_stack_auto_compaction(void)
 		EXPECT_ERR(err);
 
 		err = reftable_stack_auto_compact(st);
+		EXPECT_ERR(err);
 		EXPECT(i < 3 || st->merged->stack_len < 2 * fastlog2(i));
 	}