s4: messaging. Minor cleanup. Check for error returns on imessaging_register calls.
authorJeremy Allison <jra@samba.org>
Fri, 31 Mar 2017 18:07:35 +0000 (11:07 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 17 Apr 2017 17:13:06 +0000 (19:13 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/lib/messaging/messaging.c

index 844466d41c08239ee8b459c97a5aa6cec0a941a6..19873c5bc39dfb99c3be63c834456e6a5868d213 100644 (file)
@@ -322,6 +322,7 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
                                           struct server_id server_id,
                                           struct tevent_context *ev)
 {
+       NTSTATUS status;
        struct imessaging_context *msg;
        bool ok;
        int ret;
@@ -393,11 +394,28 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
-       imessaging_register(msg, NULL, MSG_PING, ping_message);
-       imessaging_register(msg, NULL, MSG_REQ_POOL_USAGE, pool_message);
-       imessaging_register(msg, NULL, MSG_IRPC, irpc_handler);
-       imessaging_register(msg, NULL, MSG_REQ_RINGBUF_LOG, ringbuf_log_msg);
-       IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg);
+       status = imessaging_register(msg, NULL, MSG_PING, ping_message);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+       status = imessaging_register(msg, NULL, MSG_REQ_POOL_USAGE,
+                                    pool_message);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+       status = imessaging_register(msg, NULL, MSG_IRPC, irpc_handler);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+       status = imessaging_register(msg, NULL, MSG_REQ_RINGBUF_LOG,
+                                    ringbuf_log_msg);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
+       status = IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto fail;
+       }
 
        DLIST_ADD(msg_ctxs, msg);