s3:ctdbd_conn: make sure ctdbd_init_async_connection() never returns 0 with conn...
authorStefan Metzmacher <metze@samba.org>
Mon, 13 Jun 2022 09:32:30 +0000 (11:32 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 1 Jul 2022 17:35:27 +0000 (17:35 +0000)
This should not happen anywhere, but it clears the expectation of the
caller and simplifies the error handling there.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/lib/ctdbd_conn.c

index 8fe942265900a136e4e585d4555376c066138c77..dd9206b00fd9c37f69ff6c566be95a418aef482c 100644 (file)
@@ -538,6 +538,8 @@ int ctdbd_init_async_connection(
        struct ctdbd_connection *conn = NULL;
        int ret;
 
+       *pconn = NULL;
+
        ret = ctdbd_init_connection(mem_ctx, sockname, timeout, &conn);
        if (ret != 0) {
                return ret;
@@ -546,6 +548,7 @@ int ctdbd_init_async_connection(
        ret = set_blocking(conn->fd, false);
        if (ret == -1) {
                int err = errno;
+               SMB_ASSERT(err != 0);
                TALLOC_FREE(conn);
                return err;
        }