# Non-numeric value
cat <<\EOF > exp-err || framework_failure
-error: invalid timeout
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout abc >out 2>err && fail=1
test -s out && fail=1
# Numeric value that's too big to be converted to ms and still
# fit inside an int
cat <<\EOF > exp-err || framework_failure
-error: timeout is too big
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout 2147484 >out 2>err && fail=1
test -s out && fail=1
# Numeric value with invalid suffix
cat <<\EOF > exp-err || framework_failure
-error: invalid timeout
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout 42WB >out 2>err && fail=1
test -s out && fail=1
# Numeric value with valid suffix. Suffixes are not supported for
# the <timeout> option, so this value is rejected
cat <<\EOF > exp-err || framework_failure
-error: invalid timeout
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout 42MB >out 2>err && fail=1
test -s out && fail=1
# Negative value
cat <<\EOF > exp-err || framework_failure
-error: invalid timeout
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout -1 >out 2>err && fail=1
test -s out && fail=1
# Zero. This is not a valid timeout, but the value is parsed
# correctly
cat <<\EOF > exp-err || framework_failure
-error: invalid timeout
+error: Numeric value for <timeout> option is malformed or out of range
EOF
virsh -q -c $test_url event --all --timeout 0 >out 2>err && fail=1
test -s out && fail=1
int rv = vshCommandOptInt(cmd, "timeout", timeout);
if (rv < 0 || (rv > 0 && *timeout < 1)) {
- vshError(ctl, "%s", _("invalid timeout"));
+ vshError(ctl,
+ _("Numeric value for <%s> option is malformed or out of range"),
+ "timeout");
return -1;
}
if (rv > 0) {
/* Ensure that we can multiply by 1000 without overflowing. */
if (*timeout > INT_MAX / 1000) {
- vshError(ctl, "%s", _("timeout is too big"));
+ vshError(ctl,
+ _("Numeric value for <%s> option is malformed or out of range"),
+ "timeout");
return -1;
}
*timeout *= 1000;