[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 98abf01fd6: Use correct signal oldset in posix_spawn implementa
From: |
Robert Pluim |
Subject: |
emacs-28 98abf01fd6: Use correct signal oldset in posix_spawn implementation |
Date: |
Thu, 7 Apr 2022 07:10:41 -0400 (EDT) |
branch: emacs-28
commit 98abf01fd681931f8870569ff559b547579d7cef
Author: Jürgen Hötzel <juergen@archlinux.org>
Commit: Robert Pluim <rpluim@gmail.com>
Use correct signal oldset in posix_spawn implementation
posix_spawn was restoring the wrong signal set, which still had
SIGCHLD and SIGINT masked, causing problems with child processes that
spawned child processes. (Bug#54667)
See the thread ending at
https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00067.html
for more details.
* src/callproc.c (emacs_spawn): Pass oldset parameter.
(emacs_posix_spawn_init_attributes): Use correct oldset.
(emacs_posix_spawn_init): Remove intermediate function.
(cherry picked from commit 8103b060d89ac63a12c439087bd46c30da72cd97)
---
src/callproc.c | 35 +++++++++--------------------------
1 file changed, 9 insertions(+), 26 deletions(-)
diff --git a/src/callproc.c b/src/callproc.c
index 66a35d9f33..07eeadb3aa 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1335,7 +1335,8 @@ emacs_posix_spawn_init_actions
(posix_spawn_file_actions_t *actions,
}
static int
-emacs_posix_spawn_init_attributes (posix_spawnattr_t *attributes)
+emacs_posix_spawn_init_attributes (posix_spawnattr_t *attributes,
+ const sigset_t *oldset)
{
int error = posix_spawnattr_init (attributes);
if (error != 0)
@@ -1377,11 +1378,7 @@ emacs_posix_spawn_init_attributes (posix_spawnattr_t
*attributes)
goto out;
/* Stop blocking SIGCHLD in the child. */
- sigset_t oldset;
- error = pthread_sigmask (SIG_SETMASK, NULL, &oldset);
- if (error != 0)
- goto out;
- error = posix_spawnattr_setsigmask (attributes, &oldset);
+ error = posix_spawnattr_setsigmask (attributes, oldset);
if (error != 0)
goto out;
@@ -1392,23 +1389,6 @@ emacs_posix_spawn_init_attributes (posix_spawnattr_t
*attributes)
return error;
}
-static int
-emacs_posix_spawn_init (posix_spawn_file_actions_t *actions,
- posix_spawnattr_t *attributes, int std_in,
- int std_out, int std_err, const char *cwd)
-{
- int error = emacs_posix_spawn_init_actions (actions, std_in,
- std_out, std_err, cwd);
- if (error != 0)
- return error;
-
- error = emacs_posix_spawn_init_attributes (attributes);
- if (error != 0)
- return error;
-
- return 0;
-}
-
#endif
/* Start a new asynchronous subprocess. If successful, return zero
@@ -1443,9 +1423,12 @@ emacs_spawn (pid_t *newpid, int std_in, int std_out, int
std_err,
if (use_posix_spawn)
{
/* Initialize optional attributes before blocking. */
- int error
- = emacs_posix_spawn_init (&actions, &attributes, std_in,
- std_out, std_err, cwd);
+ int error = emacs_posix_spawn_init_actions (&actions, std_in,
+ std_out, std_err, cwd);
+ if (error != 0)
+ return error;
+
+ error = emacs_posix_spawn_init_attributes (&attributes, oldset);
if (error != 0)
return error;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 98abf01fd6: Use correct signal oldset in posix_spawn implementation,
Robert Pluim <=