# ignored signals are not reset on execve

1 messages from 2022-04-05 to 2022-04-05. Participants: Rasmus Villemoes.
Thread: https://gitlist.dev/t/57665

## Rasmus Villemoes, 2022-04-05 09:08

Subject: ignored signals are not reset on execve
Message-ID: <420575be-1e0d-2c3b-ca5e-f9084688dcbb@prevas.dk>
URL: https://gitlist.dev/e/420575be-1e0d-2c3b-ca5e-f9084688dcbb%40prevas.dk

```
Hi,

run-command.c has

		for (sig = 1; sig < NSIG; sig++) {
			/* ignored signals get reset to SIG_DFL on execve */
			if (signal(sig, SIG_DFL) == SIG_IGN)
				signal(sig, SIG_IGN);
		}

introduced by commit 45afb1ca9c28 (run-command: block signals between
fork and execve).

However, 'man 7 signal' says

       A child created via fork(2) inherits a copy of its parent's
signal dispositions.  During an execve(2),  the  dispositions  of
       handled signals are reset to the default; the dispositions of
ignored signals are left unchanged.

So at least the comment is wrong, and the child is actually run with
those signals ignored. Whether that's the intent I cannot say, but I
doubt it; programs generally don't expect to be run with any signals
ignored.

Rasmus

```
