On 2025-05-31 21:57:54 +0800, Nadav Tasher wrote:
Great catch!
However, since the process status is never used (NULL provided to waitpid),
why not just set the signal handler for SIGCHLD to SIG_IGN?
This would significantly reduce the number of waitpid invocations.
Setting SIGCHLD to SIG_IGN would indeed solve the leak and costs zero
runtime overhead.
I stuck to a waitpid sweep because it’s fully portable and keeps the
option of inspecting the exit status in the future (an option I was
considering to implement to report/use errorlevel), but I’m happy to
switch if you prefer the SIG_IGN approach.
Let me know and I’ll resend the patch using:
struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags =
SA_RESTART|SA_NOCLDWAIT };
sigaction(SIGCHLD, &sa, NULL);
(SA_NOCLDWAIT for maximum portability.)
-
Valentin Lab
_______________________________________________
busybox mailing list
busybox@busybox.net
https://lists.busybox.net/mailman/listinfo/busybox