summaryrefslogtreecommitdiffhomepage
path: root/networking/udhcp/dhcpd.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-05-21 18:30:35 +0000
committerRob Landley <rob@landley.net>2006-05-21 18:30:35 +0000
commit9ffd42317b5a53c2236268808e34c90601f286c1 (patch)
treeb126ca6ff7d2db91fa3525c6e5d3978932137fa3 /networking/udhcp/dhcpd.c
parentc020f5f518714af603488c7d9e6cc72543fabc49 (diff)
Minor cleanups: Convert a few calloc() calls to xzalloc, remove unnecessary
memset, collate variable declarations...
Diffstat (limited to 'networking/udhcp/dhcpd.c')
-rw-r--r--networking/udhcp/dhcpd.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 0dfc0b559..28acb6bcc 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -52,30 +52,18 @@ struct dhcpOfferedAddr *leases;
struct server_config_t server_config;
-#ifdef COMBINED_BINARY
int udhcpd_main(int argc, char *argv[])
-#else
-int main(int argc, char *argv[])
-#endif
{
fd_set rfds;
struct timeval tv;
- int server_socket = -1;
- int bytes, retval;
+ int server_socket = -1, bytes, retval, max_sock;
struct dhcpMessage packet;
- uint8_t *state;
- uint8_t *server_id, *requested;
- uint32_t server_id_align, requested_align;
- unsigned long timeout_end;
+ uint8_t *state, *server_id, *requested;
+ uint32_t server_id_align, requested_align, static_lease_ip;
+ unsigned long timeout_end, num_ips;
struct option_set *option;
- struct dhcpOfferedAddr *lease;
- struct dhcpOfferedAddr static_lease;
- int max_sock;
- unsigned long num_ips;
-
- uint32_t static_lease_ip;
+ struct dhcpOfferedAddr *lease, static_lease;
- memset(&server_config, 0, sizeof(struct server_config_t));
read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]);
/* Start the log, sanitize fd's, and write a pid file */
@@ -96,7 +84,7 @@ int main(int argc, char *argv[])
server_config.max_leases = num_ips;
}
- leases = xcalloc(server_config.max_leases, sizeof(struct dhcpOfferedAddr));
+ leases = xzalloc(server_config.max_leases * sizeof(struct dhcpOfferedAddr));
read_leases(server_config.lease_file);
if (read_interface(server_config.interface, &server_config.ifindex,