]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pg: Reset SIGCHLD to default
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 7 Mar 2026 20:13:21 +0000 (21:13 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 7 Mar 2026 20:13:21 +0000 (21:13 +0100)
When pg runs a child process, i.e. evaluating an "!" command, it calls
wait to receive status for the child.

If SIGCHLD is ignored, this results in an endless loop. Fix this by
resetting SIGCHLD to default before the any fork() call is performed.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
text-utils/pg.c

index 81eba938ccd69fc3fd0d4b899d21907db4fb3cde..939086bc88f32d30c52ae0389a4da43011fff1eb 100644 (file)
@@ -1687,6 +1687,10 @@ int main(int argc, char **argv)
                        invopt(argv[arg]);
                }
        }
+
+       /* clear any inherited settings */
+       signal(SIGCHLD, SIG_DFL);
+
        if (argc == 1)
                pgfile(stdin, "stdin");
        else