Don't block signals when running hooks. Here ctx->sigset == defsigs ==

0x60006003, which blocks SIGTERM by default, so running something simple
from a hook, like /etc/rc.d/racoon restart does not work. The script
is then stuck waiting for the daemon to die, which it won't since it will
never receive the signal, and the hook never terminates.
This commit is contained in:
christos 2020-04-05 15:41:45 +00:00
parent 6ce4f404a1
commit e35433dceb
1 changed files with 2 additions and 1 deletions

View File

@ -108,7 +108,8 @@ script_exec(const struct dhcpcd_ctx *ctx, char *const *argv, char *const *env)
for (i = 0; i < dhcpcd_signals_len; i++)
sigaddset(&defsigs, dhcpcd_signals[i]);
posix_spawnattr_setsigdefault(&attr, &defsigs);
posix_spawnattr_setsigmask(&attr, &ctx->sigset);
sigemptyset(&defsigs);
posix_spawnattr_setsigmask(&attr, &defsigs);
#endif
errno = 0;
r = posix_spawn(&pid, argv[0], NULL, &attr, argv, env);