diff options
-rw-r--r-- | cli/src/cli-cmd.c | 3 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index b415569be28..cc9072246d3 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -302,6 +302,9 @@ cli_cmd_await_response (unsigned time) return cli_op_ret; } +/* This function must be called _only_ after all actions associated with + * command processing is complete. Otherwise, gluster process may exit before + * reporting results to stdout/stderr. */ int cli_cmd_broadcast_response (int32_t status) { diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 4184bc161eb..c26e1bbbd8d 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -484,10 +484,11 @@ gf_cli_list_friends_cbk (struct rpc_req *req, struct iovec *iov, ret = 0; out: - cli_cmd_broadcast_response (ret); if (ret) cli_err ("%s: failed", cmd); + cli_cmd_broadcast_response (ret); + if (dict) dict_destroy (dict); @@ -850,10 +851,11 @@ next: ret = 0; out: - cli_cmd_broadcast_response (ret); if (ret) cli_err ("%s", err_str); + cli_cmd_broadcast_response (ret); + if (dict) dict_destroy (dict); |