Mercurial > hg > dhcpcd
changeset 5123:9422e8c904d5 draft
scripts: Run with an empty sigmask
An empty signal mask is probably more appropriate, since most
programs presume that the signal mask is empty when they start
even when they are using signals.
| author | Christos Zoulas <christos@zoulas.com> |
|---|---|
| date | Mon, 06 Apr 2020 21:11:45 +0100 |
| parents | a44d7acff84b |
| children | a044710d9480 |
| files | src/privsep-root.c src/script.c src/script.h |
| diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/privsep-root.c Sun Apr 05 07:47:14 2020 +0100 +++ b/src/privsep-root.c Mon Apr 06 21:11:45 2020 +0100 @@ -188,7 +188,7 @@ if (script_buftoenv(ctx, UNCONST(envbuf), len) == NULL) return -1; - pid = script_exec(ctx, argv, ctx->script_env); + pid = script_exec(argv, ctx->script_env); if (pid == -1) return -1; /* Wait for the script to finish */
--- a/src/script.c Sun Apr 05 07:47:14 2020 +0100 +++ b/src/script.c Mon Apr 06 21:11:45 2020 +0100 @@ -84,7 +84,7 @@ } pid_t -script_exec(const struct dhcpcd_ctx *ctx, char *const *argv, char *const *env) +script_exec(char *const *argv, char *const *env) { pid_t pid = 0; posix_spawnattr_t attr; @@ -105,10 +105,10 @@ flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF; posix_spawnattr_setflags(&attr, flags); sigemptyset(&defsigs); + posix_spawnattr_setsigmask(&attr, &defsigs); for (i = 0; i < dhcpcd_signals_len; i++) sigaddset(&defsigs, dhcpcd_signals[i]); posix_spawnattr_setsigdefault(&attr, &defsigs); - posix_spawnattr_setsigmask(&attr, &ctx->sigset); #endif errno = 0; r = posix_spawn(&pid, argv[0], NULL, &attr, argv, env); @@ -657,7 +657,7 @@ pid_t pid; int status = 0; - pid = script_exec(ctx, argv, ctx->script_env); + pid = script_exec(argv, ctx->script_env); if (pid == -1) logerr("%s: %s", __func__, argv[0]); else if (pid != 0) {
--- a/src/script.h Sun Apr 05 07:47:14 2020 +0100 +++ b/src/script.h Mon Apr 06 21:11:45 2020 +0100 @@ -34,7 +34,7 @@ __printflike(2, 3) int efprintf(FILE *, const char *, ...); void if_printoptions(void); char ** script_buftoenv(struct dhcpcd_ctx *, char *, size_t); -pid_t script_exec(const struct dhcpcd_ctx *, char *const *, char *const *); +pid_t script_exec(char *const *, char *const *); int send_interface(struct fd_list *, const struct interface *, int); int script_runreason(const struct interface *, const char *); int script_runchroot(struct dhcpcd_ctx *, char *);
