s3:messaging: allow the messaging receive callback to change the fds
authorMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 09:29:22 +0000 (11:29 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 14:36:10 +0000 (16:36 +0200)
This allows the callback to consume the fds and e.g. set
them to -1 so that the caller can then treat (close) only those
fds that have not been consumed.

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
source3/lib/messages_dgm.c
source3/lib/messages_dgm.h

index e2d0880e043757818335a66aa342f646cc8fb913..86198771ff8fd5a60a142ed524fe1523c948cb82 100644 (file)
@@ -204,7 +204,7 @@ bool message_send_all(struct messaging_context *msg_ctx,
 }
 
 static void messaging_recv_cb(const uint8_t *msg, size_t msg_len,
-                             const int *fds, size_t num_fds,
+                             int *fds, size_t num_fds,
                              void *private_data)
 {
        struct messaging_context *msg_ctx = talloc_get_type_abort(
index 30ab7439aad8dc292bedfe0e6f436ecb564e836b..ae35282b4afd4374287a4bee6b945dad985af41c 100644 (file)
@@ -44,7 +44,7 @@ struct messaging_dgm_context {
 
        void (*recv_cb)(const uint8_t *msg,
                        size_t msg_len,
-                       const int *fds,
+                       int *fds,
                        size_t num_fds,
                        void *private_data);
        void *recv_cb_private_data;
@@ -181,7 +181,7 @@ int messaging_dgm_init(struct tevent_context *ev,
                       uid_t dir_owner,
                       void (*recv_cb)(const uint8_t *msg,
                                       size_t msg_len,
-                                      const int *fds,
+                                      int *fds,
                                       size_t num_fds,
                                       void *private_data),
                       void *recv_cb_private_data)
index be4b1e5eec0b889624907407a8c9a2c00a76e532..00ff56f30c3f7c04852e1d1d67f19ac76b53bc36 100644 (file)
@@ -26,7 +26,7 @@ int messaging_dgm_init(struct tevent_context *ev,
                       uid_t dir_owner,
                       void (*recv_cb)(const uint8_t *msg,
                                       size_t msg_len,
-                                      const int *fds,
+                                      int *fds,
                                       size_t num_fds,
                                       void *private_data),
                       void *recv_cb_private_data);