]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
utils: relax strtoX checking in get_time_rtt
authorFlorian Westphal <fw@strlen.de>
Tue, 11 Nov 2014 00:38:21 +0000 (01:38 +0100)
committerStephen Hemminger <shemming@brocade.com>
Sat, 22 Nov 2014 21:52:44 +0000 (13:52 -0800)
ip route change dev tap0 192.168.7.0/24 rto_min 1ms
Error: argument "1ms" is wrong: "rto_min" value is invalid

get_time_rtt() checks for 's' or 'msec' and converts to milliseconds
if needed.

Fixes: 697ac63905 (utils: fix range checking for get_u32/get_u64 et all)
Signed-off-by: Florian Westphal <fw@strlen.de>
lib/utils.c

index dc21567aca3a2703fd8103f57366872f706baafa..987377b689a05f7d8e07e26736e10108a5cd5427 100644 (file)
@@ -144,8 +144,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
                if (t < 0.0)
                        return -1;
 
-               /* extra non-digits */
-               if (!p || p == arg || *p)
+               /* no digits? */
+               if (!p || p == arg)
                        return -1;
 
                /* over/underflow */
@@ -154,8 +154,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
        } else {
                res = strtoul(arg, &p, 0);
 
-               /* empty string or trailing non-digits */
-               if (!p || p == arg || *p)
+               /* empty string? */
+               if (!p || p == arg)
                        return -1;
 
                /* overflow */