s3:messaging: upon receiving fds, dup them so the caller can safely close them.
authorMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 07:48:18 +0000 (09:48 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 14:36:10 +0000 (16:36 +0200)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/lib/messages.c

index 86198771ff8fd5a60a142ed524fe1523c948cb82..aaaee52e3a6f53398c22f7ea4b537b9425f5b54e 100644 (file)
@@ -231,8 +231,13 @@ static void messaging_recv_cb(const uint8_t *msg, size_t msg_len,
                return;
        }
 
+       /*
+        * "consume" the fds by copying them and setting
+        * the original variable to -1
+        */
        for (i=0; i < num_fds; i++) {
                fds64[i] = fds[i];
+               fds[i] = -1;
        }
 
        /*