messaging: Avoid a socket leak after fork
authorVolker Lendecke <vl@samba.org>
Wed, 30 Aug 2017 15:49:54 +0000 (17:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 5 Sep 2017 17:12:34 +0000 (19:12 +0200)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13006

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Sep  5 19:12:34 CEST 2017 on sn-devel-144

source3/lib/messages_dgm.c

index f29180d7ec25909fd9d3808891a44b94e72762cc..9d87746fa2cfd521f2f2493bb2663ac304795791 100644 (file)
@@ -280,7 +280,8 @@ static int messaging_dgm_out_destructor(struct messaging_dgm_out *out)
 {
        DLIST_REMOVE(out->ctx->outsocks, out);
 
-       if (tevent_queue_length(out->queue) != 0) {
+       if ((tevent_queue_length(out->queue) != 0) &&
+           (getpid() == out->ctx->pid)) {
                /*
                 * We have pending jobs. We can't close the socket,
                 * this has been handed over to messaging_dgm_out_queue_state.