#include "source3/lib/substitute.h"
#include "lib/addrchange.h"
#include "../source4/lib/tls/tls.h"
+#include "libcli/smb/smbXcli_base.h"
#ifdef HAVE_LIBQUIC
#include <netinet/quic.h>
static void remove_child_pid(struct smbd_parent_context *parent,
pid_t pid,
- bool unclean_shutdown)
+ bool unclean_shutdown,
+ bool ignore)
{
struct smbd_child_pid *child;
NTSTATUS status;
return;
}
+ if (ignore) {
+ DBG_WARNING("Ignoring exit of child %d\n", pid);
+ return;
+ }
+
if (pid == procid_to_pid(&parent->cleanupd)) {
struct tevent_req *req;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
bool unclean_shutdown = False;
+ bool ignore = false;
/* If the child terminated normally, assume
it was an unclean shutdown unless the
status is 0
*/
if (WIFEXITED(status)) {
- unclean_shutdown = WEXITSTATUS(status);
+ int exitcode = WEXITSTATUS(status);
+ unclean_shutdown = (exitcode != 0);
+#ifdef ENABLE_SELFTEST
+ ignore = (exitcode ==
+ SMB_SUICIDE_EXIT_STATUS_BYPASS_CLEANUP);
+#endif
}
/* If the child terminated due to a signal
we always assume it was unclean.
if (WIFSIGNALED(status)) {
unclean_shutdown = True;
}
- remove_child_pid(parent, pid, unclean_shutdown);
+ remove_child_pid(parent, pid, unclean_shutdown, ignore);
}
}