confile: clean up network configuration parsing

parent 20f0e57d
...@@ -201,12 +201,12 @@ extern int get_u16(unsigned short *val, const char *arg, int base) ...@@ -201,12 +201,12 @@ extern int get_u16(unsigned short *val, const char *arg, int base)
char *ptr; char *ptr;
if (!arg || !*arg) if (!arg || !*arg)
return -1; return ret_errno(EINVAL);
errno = 0; errno = 0;
res = strtoul(arg, &ptr, base); res = strtoul(arg, &ptr, base);
if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0) if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0)
return -1; return ret_errno(ERANGE);
*val = res; *val = res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment