aboutsummaryrefslogtreecommitdiffstats
path: root/run-command.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-03-29 16:39:10 +0900
committerJunio C Hamano <gitster@pobox.com>2025-03-29 16:39:10 +0900
commitf76fe4ab067b9d6e530edf8205b5672ebad27bfc (patch)
tree7d8e5a823e75ee64c35b839fceedd9cbeb5074c5 /run-command.c
parentMerge branch 'en/diff-rename-follow-fix' (diff)
parentconfig.mak.dev: enable -Wunreachable-code (diff)
downloadgit-f76fe4ab067b9d6e530edf8205b5672ebad27bfc.tar.gz
git-f76fe4ab067b9d6e530edf8205b5672ebad27bfc.zip
Merge branch 'jk/use-wunreachable-code-for-devs'
Enable -Wunreachable-code for developer builds. * jk/use-wunreachable-code-for-devs: config.mak.dev: enable -Wunreachable-code git-compat-util: add NOT_CONSTANT macro and use it in atfork_prepare() run-command: use errno to check for sigfillset() error
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index 402138b8b5..8833b23367 100644
--- a/run-command.c
+++ b/run-command.c
@@ -515,7 +515,13 @@ static void atfork_prepare(struct atfork_state *as)
{
sigset_t all;
- if (sigfillset(&all))
+ /*
+ * POSIX says sigfillset() can fail, but an overly clever
+ * compiler can see through the header files and decide
+ * it cannot fail on a particular platform it is compiling for,
+ * triggering -Wunreachable-code false positive.
+ */
+ if (NOT_CONSTANT(sigfillset(&all)))
die_errno("sigfillset");
#ifdef NO_PTHREADS
if (sigprocmask(SIG_SETMASK, &all, &as->old))