client: Return the correct status sent from the daemon
authorAmitay Isaacs <amitay@gmail.com>
Thu, 23 Jul 2015 21:39:26 +0000 (07:39 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 31 Jul 2015 03:35:01 +0000 (13:35 +1000)
If a control fails and error message is set, the returned status of the
control is always set to -1 ignoring the status passed by the daemon.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(Imported from commit 1286b02e24a521dafa7061d09fb5c21d1ebb3011)

client/ctdb_client.c

index 1c33e66d306e8ce3930afcb993df53375bb319ee..32c935750a5adbb53be0207bdc72dde061634e82 100644 (file)
@@ -1138,7 +1138,7 @@ int ctdb_control_recv(struct ctdb_context *ctdb,
                        state->async.fn(state);
                }
                talloc_free(tmp_ctx);
-               return -1;
+               return (status == 0 ? -1 : state->status);
        }
 
        if (outdata) {