Fix to range dynamic-bootp specifier
authorSami Kerola <kerolasa@iki.fi>
Sat, 22 Jan 2011 11:06:34 +0000 (12:06 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 22 Jan 2011 11:06:34 +0000 (12:06 +0100)
Rely on inet_aton return value instead of some unreliable
conversion result after first syscall failed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>

src/getdata.c

index ae3bc38..0356649 100644 (file)
@@ -49,7 +49,6 @@ extern char *malloc();
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
-#include <limits.h>
 
 #include "dhcpd-pools.h"
 #include "defaults.h"
@@ -425,12 +424,11 @@ char *parse_config(int is_include, char *config_file,
                        case 3:
                                /* printf ("range 1nd ip: %s\n", word); */
                                range_p = ranges + num_ranges;
-                               inet_aton(word, &inp);
-                               range_p->first_ip = htonl(inp.s_addr) - 1;
-                               if (range_p->first_ip == UINT_MAX) {
+                               if (!(inet_aton(word, &inp))) {
                                        /* word was not ip, try again */
                                        break;
                                }
+                               range_p->first_ip = htonl(inp.s_addr) - 1;
                                argument = 2;
                                break;
                        case 4: