1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

printing: Avoid zombies in the background daemon

Whatever you read about waitpid() tells you should should run it in a
loop.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Volker Lendecke 2021-04-23 11:17:33 +02:00 committed by Andreas Schneider
parent ce97c67186
commit 8d2eb62a10

View File

@ -264,14 +264,20 @@ static void bq_sig_chld_handler(struct tevent_context *ev_ctx,
int status;
pid_t pid;
do {
do {
pid = waitpid(-1, &status, WNOHANG);
} while ((pid == -1) && (errno == EINTR));
if (WIFEXITED(status)) {
DEBUG(6, ("Bq child process %d terminated with %d\n",
(int)pid, WEXITSTATUS(status)));
DBG_INFO("Bq child process %d terminated with %d\n",
(int)pid,
WEXITSTATUS(status));
} else {
DEBUG(3, ("Bq child process %d terminated abnormally\n",
(int)pid));
DBG_NOTICE("Bq child process %d terminated abnormally\n",
(int)pid);
}
} while (pid > 0);
}
static void bq_setup_sig_chld_handler(struct tevent_context *ev_ctx)