]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: do timing even for unusable connections
authorJán Tomko <jtomko@redhat.com>
Thu, 29 Nov 2012 10:46:00 +0000 (11:46 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 29 Nov 2012 17:10:08 +0000 (10:10 -0700)
Time values were uninitialized if the connection wasn't usable.

tools/virsh.c

index 63721770e480e66018afb1ef4df43ac5feca6ab4..dea3f824937541a366adcd29c41a6aa703817e72 100644 (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) &&