]> xenbits.xensource.com Git - libvirt.git/commitdiff
daemon: Error and exit if specified value for timeout is not valid
authorOsier Yang <jyang@redhat.com>
Mon, 19 Sep 2011 04:16:45 +0000 (12:16 +0800)
committerOsier Yang <jyang@redhat.com>
Tue, 20 Sep 2011 03:14:24 +0000 (11:14 +0800)
Silently setting "timeout" as -1 if the specified value is invalid
is a bit confused.

daemon/libvirtd.c

index c708ff76a45b36c009fa0275ae92ce18dcd1fe7d..d1bc3ddda75d305a1c6d51a770b19af21caf1c78 100644 (file)
@@ -1311,8 +1311,10 @@ int main(int argc, char **argv) {
             if (virStrToLong_i(optarg, &tmp, 10, &timeout) != 0
                 || timeout <= 0
                 /* Ensure that we can multiply by 1000 without overflowing.  */
-                || timeout > INT_MAX / 1000)
-                timeout = -1;
+                || timeout > INT_MAX / 1000) {
+                VIR_ERROR(_("Invalid value for timeout"));
+                exit(EXIT_FAILURE);
+            }
             break;
 
         case 'p':