summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-cmd.c')
-rw-r--r--cli/src/cli-cmd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c
index d7a4fcd837a..7dc416803c5 100644
--- a/cli/src/cli-cmd.c
+++ b/cli/src/cli-cmd.c
@@ -239,7 +239,7 @@ cli_cmd_await_response ()
int ret = 0;
cli_op_ret = -1;
- cmd_done = 0;
+
time (&ts.tv_sec);
ts.tv_sec += CLI_DEFAULT_CMD_TIMEOUT;
while (!cmd_done && !ret) {
@@ -247,6 +247,8 @@ cli_cmd_await_response ()
&ts);
}
+ cmd_done = 0;
+
cli_cmd_unlock ();
if (ret)
@@ -258,19 +260,19 @@ cli_cmd_await_response ()
int
cli_cmd_broadcast_response (int32_t status)
{
- if (!cmd_sent)
- goto out;
pthread_mutex_lock (&cond_mutex);
{
+ if (!cmd_sent)
+ goto out;
cmd_done = 1;
cli_op_ret = status;
pthread_cond_broadcast (&cond);
}
- pthread_mutex_unlock (&cond_mutex);
out:
+ pthread_mutex_unlock (&cond_mutex);
return 0;
}