[PATCH v3 2/8] scalar-unregister: handle error codes greater than 0
- From
Victoria Dye via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Aug 18, 2022, 21:40 UTC
- Message-ID
- <a6bb0113b9c2eaf0cabc4079bd0928e04c07a96c.1660858853.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1324.v3.git.1660858853.gitgitgadget@gmail.com>
From: Victoria Dye <vdye@github.com>
When 'scalar unregister' tries to disable maintenance and remove an enlistment, ensure that the return value is nonzero if either operation produces *any* nonzero return value, not just when they return a value less than 0.
Signed-off-by: Victoria Dye <vdye@github.com> --- contrib/scalar/scalar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index 92b648f3511..8ef8dd55041 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -223,10 +223,10 @@ static int unregister_dir(void) { int res = 0; - if (toggle_maintenance(0) < 0) + if (toggle_maintenance(0)) res = -1; - if (add_or_remove_enlistment(0) < 0) + if (add_or_remove_enlistment(0)) res = -1; return res;
-- gitgitgadget