From: Osier Yang Date: Mon, 19 Sep 2011 04:16:45 +0000 (+0800) Subject: daemon: Error and exit if specified value for timeout is not valid X-Git-Tag: v0.9.5~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=232392b1c696b12311eb5727b631e7aec70ae97c;p=thirdparty%2Flibvirt.git daemon: Error and exit if specified value for timeout is not valid Silently setting "timeout" as -1 if the specified value is invalid is a bit confused. --- diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index c708ff76a4..d1bc3ddda7 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':