aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-10-12 18:52:09 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-10-12 18:52:09 +0300
commit5f2769a03542c039720b98525477495acaa51a06 (patch)
treed91450efd729e3804095945631b37221d7500e08 /src
parent055f49e2c626027c6a1641d7cd4b9c66aebbe403 (diff)
downloadpies-5f2769a03542c039720b98525477495acaa51a06.tar.gz
pies-5f2769a03542c039720b98525477495acaa51a06.tar.bz2
Make sure exited preprocessor gets cleaned up when running with PID 1.
* NEWS: Version 1.4.90 * configure.ac: Version 1.4.90 * src/pies.c (main): When running with PID 1, install a minimal SIGCHLD handler before parsing configuration files.
Diffstat (limited to 'src')
-rw-r--r--src/pies.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pies.c b/src/pies.c
index 75285dc..a8529ac 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -1885,6 +1885,13 @@ sig_handler (int sig)
}
}
+RETSIGTYPE
+sigchld_early (int sig)
+{
+ while (waitpid (-1, NULL, WNOHANG) != -1)
+ ;
+}
+
void
setsigvhan (RETSIGTYPE (*handler) (int signo), int *sigv, int sigc)
{
@@ -2284,6 +2291,12 @@ main (int argc, char **argv)
set_quoting_style (NULL, shell_quoting_style);
init_process = getpid () == 1;
+ if (init_process)
+ {
+ int s[] = { SIGCHLD };
+ setsigvhan (sigchld_early, s, 1);
+ }
+
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--no-init") == 0)

Return to:

Send suggestions and report system problems to the System administrator.