diff svr-runopts.c @ 492:b956d6151600

Replace calls to strtoul() with a helper m_str_to_uint()
author Matt Johnston <matt@ucc.asn.au>
date Mon, 22 Sep 2008 14:13:44 +0000
parents 7e43f5e473b9
children 6cd2152aae0b b85507ade010
line wrap: on
line diff
--- a/svr-runopts.c	Mon Sep 22 14:13:14 2008 +0000
+++ b/svr-runopts.c	Mon Sep 22 14:13:44 2008 +0000
@@ -284,16 +284,13 @@
 	
 	if (recv_window_arg) {
 		opts.recv_window = atol(recv_window_arg);
-		if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW)
-		{
+		if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW) {
 			dropbear_exit("Bad recv window '%s'", recv_window_arg);
 		}
 	}
 	
 	if (keepalive_arg) {
-		opts.keepalive_secs = strtoul(keepalive_arg, NULL, 10);
-		if (opts.keepalive_secs == 0 && errno == EINVAL)
-		{
+		if (m_str_to_uint(keepalive_arg, &opts.keepalive_secs) == DROPBEAR_FAILURE) {
 			dropbear_exit("Bad keepalive '%s'", keepalive_arg);
 		}
 	}