]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/mktree.c
builtins + test helpers: use return instead of exit() in cmd_*
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Tue, 8 Jun 2021 10:48:03 +0000 (12:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Jun 2021 00:15:58 +0000 (09:15 +0900)
commit338abb0f045b87df5e628543800e74dec0e72cdf
tree52e8b1cb82decf173d31647abca84a65945fc93c
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7
builtins + test helpers: use return instead of exit() in cmd_*

Change various cmd_* functions that claim to return an "int" to use
"return" instead of exit() to indicate an exit code. These were not
marked with NORETURN, and by directly exit()-ing we'll skip the
cleanup git.c would otherwise do (e.g. closing fd's, erroring if we
can't). See run_builtin() in git.c.

In the case of shell.c and sh-i18n--envsubst.c this was the result of
an incomplete migration to using a cmd_main() in 3f2e2297b9 (add an
extra level of indirection to main(), 2016-07-01).

This was spotted by SunCC 12.5 on Solaris 10 (gcc210 on the gccfarm).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/difftool.c
builtin/merge-ours.c
builtin/mktree.c
sh-i18n--envsubst.c
shell.c
t/helper/test-hash-speed.c
t/helper/test-hash.c
t/helper/test-match-trees.c
t/helper/test-reach.c