diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 46e655a6e4f..4edca4b90e8 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -579,8 +579,6 @@ static void remove_child_pid(struct smbd_parent_context *parent, __func__, strerror(ret))); } - smbprofile_cleanup(pid, getpid()); - for (child = parent->children; child != NULL; child = child->next) { if (child->pid == pid) { struct smbd_child_pid *tmp = child; diff --git a/source3/smbd/smbd_cleanupd.c b/source3/smbd/smbd_cleanupd.c index f11a0a443d1..2f3d19fbf5a 100644 --- a/source3/smbd/smbd_cleanupd.c +++ b/source3/smbd/smbd_cleanupd.c @@ -21,6 +21,7 @@ #include "smbd_cleanupd.h" #include "lib/util/tevent_ntstatus.h" #include "lib/util/debug.h" +#include "smbprofile.h" struct smbd_cleanupd_state { pid_t parent_pid; @@ -98,6 +99,8 @@ static void smbd_cleanupd_process_exited(struct messaging_context *msg, DBG_DEBUG("%d exited %sclean\n", (int)pid, unclean_shutdown ? "un" : ""); + + smbprofile_cleanup(pid, state->parent_pid); } NTSTATUS smbd_cleanupd_recv(struct tevent_req *req)