summaryrefslogtreecommitdiffhomepage
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-08 12:49:22 +0000
commit1385899416a4396385ad421ae1f532be7103738a (patch)
treefc4d14a910593d1235318bb36abe5e9f72d2039e /networking/udhcp
parent5625415085e68ac5e150f54e685417c866620d76 (diff)
attempt to regularize atoi mess.
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/dhcpc.c4
-rw-r--r--networking/udhcp/files.c8
2 files changed, 5 insertions, 7 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 9ab6aee8c..f2cf82f05 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -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);
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index d9dfb8965..52d383869 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -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;
}