]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
executor: really set POSIX_SPAWN_SETSIGDEF for posix_spawn
authorLuca Boccassi <bluca@debian.org>
Mon, 5 Feb 2024 14:22:52 +0000 (14:22 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 5 Feb 2024 16:26:01 +0000 (16:26 +0000)
posix_spawnattr_setflags() doesn't OR the input to the current set of flags,
it overwrites them, so we are currently losing POSIX_SPAWN_SETSIGDEF.

Follow-up for: 6ecdfe7d1008964eed3f67b489cef8c65a218bf1

src/basic/process-util.c

index 1238ef815058f9807866229170a3bacaba2e3a74..701eea673c5aa38b4bc3ff2e0e917471b58a529e 100644 (file)
@@ -2054,10 +2054,8 @@ int posix_spawn_wrapper(const char *path, char *const *argv, char *const *envp,
         r = posix_spawnattr_init(&attr);
         if (r != 0)
                 return -r; /* These functions return a positive errno on failure */
-        r = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK);
-        if (r != 0)
-                goto fail;
-        r = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF); /* Set all signals to SIG_DFL */
+        /* Set all signals to SIG_DFL */
+        r = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGMASK|POSIX_SPAWN_SETSIGDEF);
         if (r != 0)
                 goto fail;
         r = posix_spawnattr_setsigmask(&attr, &mask);