virsh: do timing even for unusable connections

Time values were uninitialized if the connection wasn't usable.
This commit is contained in:
Ján Tomko
2012-11-29 10:10:08 -07:00
committed by Eric Blake
parent dc04b2a737
commit 8b235d4057
+6 -6
View File
@@ -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) &&