ctdb-tools: Add early return for empty connection list
authorMartin Schwenke <martin@meltin.net>
Fri, 5 Aug 2016 01:27:14 +0000 (11:27 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 8 Aug 2016 06:17:33 +0000 (08:17 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12121

If the connection list is empty then process_clist_send() still
creates a request.  However, since no subrequests are created for
controls sent, tevent_req_poll() waits forever for an event.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/ctdb.c

index 075b3547933b21dad8c86108361ca5de8e0fc080..b00c3fc043681dbce20f8729befc5f83fa89b5d6 100644 (file)
@@ -3230,6 +3230,9 @@ static int control_addtickle(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                if (ret != 0) {
                        return ret;
                }
+               if (count == 0) {
+                       return 0;
+               }
 
                req = process_clist_send(mem_ctx, ctdb, clist, count,
                                 ctdb_req_control_tcp_add_delayed_update,
@@ -3288,6 +3291,9 @@ static int control_deltickle(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                if (ret != 0) {
                        return ret;
                }
+               if (count == 0) {
+                       return 0;
+               }
 
                req = process_clist_send(mem_ctx, ctdb, clist, count,
                                         ctdb_req_control_tcp_remove,