diff --git a/mxqsub.c b/mxqsub.c index d4d8eb2..15c9ba9 100644 --- a/mxqsub.c +++ b/mxqsub.c @@ -784,8 +784,18 @@ int main(int argc, char *argv[]) mx_log_warning("option '--time' is deprecated. please use '--runtime' or '-t' in future calls."); case 't': if (mx_strtou32(optctl.optarg, &arg_time) < 0) { - mx_log_crit("--runtime '%s': %m", optctl.optarg); - exit(EX_CONFIG); + unsigned long long int minutes; + + if(mx_strtominutes(optctl.optarg, &minutes) < 0) { + mx_log_crit("--runtime '%s': %m", optctl.optarg); + exit(EX_CONFIG); + } + if ((unsigned long long int)(uint32_t)minutes != minutes) { + errno = ERANGE; + mx_log_crit("--runtime '%s': %m", optctl.optarg); + exit(EX_CONFIG); + } + arg_time = (uint32_t)minutes; } break; diff --git a/test_mx_util.c b/test_mx_util.c index 1ffcfe9..d4ba5db 100644 --- a/test_mx_util.c +++ b/test_mx_util.c @@ -44,6 +44,7 @@ static void test_mx_strtoul(void) assert(mx_strtoul("-1", &l) == -ERANGE); assert(mx_strtoul(" -1", &l) == -ERANGE); + assert(mx_strtoul("123s", &l) == -EINVAL); assert(mx_strtoul("0888", &l) == -EINVAL); assert(mx_strtoul("1.2", &l) == -EINVAL); assert(mx_strtoul("1,2", &l) == -EINVAL);