[PATCH] daemon: Error and exit if specified value for timeout is not valid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Silently setting "timeout" as -1 if the specified value is invalid
is a bit confused.
---
 daemon/libvirtd.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index c708ff7..4dd68d5 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -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':
-- 
1.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]