added auto-reaping to childeren

This commit is contained in:
2026-05-25 15:21:33 +03:00
parent 5e33b1c6c3
commit 3f16cb502c
+6
View File
@@ -276,6 +276,12 @@ int main(void)
sigaction(SIGTERM, &sa, NULL);
sigaction(SIGINT, &sa, NULL);
struct sigaction sa_chld;
memset(&sa_chld, 0, sizeof(sa_chld));
sa_chld.sa_handler = SIG_IGN;
sa_chld.sa_flags = SA_NOCLDWAIT;
sigaction(SIGCHLD, &sa_chld, NULL);
pid_t fork_pgid = getpgrp();
int owns_pgrp = 0;
if (!isatty(STDIN_FILENO) || tcgetpgrp(STDIN_FILENO) != fork_pgid) {