ctdb-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)
committerMartin Schwenke <martins@samba.org>
Wed, 29 Jul 2015 08:33:29 +0000 (10:33 +0200)
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>
ctdb/client/ctdb_client.c

index 7bffefefe87822238c5b0d9db7c439170e87f553..3383c579a56991b857a25c7ebd357ca765e8bf54 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) {