Time values were uninitialized if the connection wasn't usable.
---
tools/virsh.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 6372177..dea3f82 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1562,20 +1562,20 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd)
!(cmd->def->flags & VSH_CMD_FLAG_NOCONNECT))
vshReconnect(ctl);
+ if (enable_timing)
+ GETTIMEOFDAY(&before);
+
if ((cmd->def->flags & VSH_CMD_FLAG_NOCONNECT) ||
vshConnectionUsability(ctl, ctl->conn)) {
- if (enable_timing)
- GETTIMEOFDAY(&before);
-
ret = cmd->def->handler(ctl, cmd);
-
- if (enable_timing)
- GETTIMEOFDAY(&after);
} else {
/* connection is not usable, return error */
ret = false;
}
+ if (enable_timing)
+ GETTIMEOFDAY(&after);
+
/* try to automatically catch disconnections */
if (!ret &&
((last_error != NULL) &&
--
1.7.8.6