attempt to regularize atoi mess.
This commit is contained in:
@@ -262,10 +262,10 @@ int udhcpc_main(int argc, char *argv[])
|
||||
client_config.script = optarg;
|
||||
break;
|
||||
case 'T':
|
||||
client_config.timeout = atoi(optarg);
|
||||
client_config.timeout = xatoi_u(optarg);
|
||||
break;
|
||||
case 't':
|
||||
client_config.retries = atoi(optarg);
|
||||
client_config.retries = xatoi_u(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
printf("version %s\n\n", BB_VER);
|
||||
|
||||
@@ -35,7 +35,8 @@ static int read_ip(const char *line, void *arg)
|
||||
int retval = 1;
|
||||
|
||||
if (!inet_aton(line, addr)) {
|
||||
if ((host = gethostbyname(line)))
|
||||
host = gethostbyname(line);
|
||||
if (host)
|
||||
addr->s_addr = *((unsigned long *) host->h_addr_list[0]);
|
||||
else retval = 0;
|
||||
}
|
||||
@@ -72,10 +73,7 @@ static int read_str(const char *line, void *arg)
|
||||
|
||||
static int read_u32(const char *line, void *arg)
|
||||
{
|
||||
uint32_t *dest = arg;
|
||||
char *endptr;
|
||||
*dest = strtoul(line, &endptr, 0);
|
||||
return endptr[0] == '\0';
|
||||
return safe_strtou32(line, (uint32_t*)arg) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user