summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-04 21:48:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-05-04 21:48:17 +0000
commit5ec5305e22fc4dfccfa05a507821188925c211f7 (patch)
tree5ce5edc81fb58f84e1e5233dda4585ca36573d89 /sbin
parent5a6ba6e15fe81b53aabd942f225da0cd247f721f (diff)
knf
Diffstat (limited to 'sbin')
-rw-r--r--sbin/dhclient/dispatch.c13
-rw-r--r--sbin/dhclient/inet.c9
-rw-r--r--sbin/dhclient/parse.c21
3 files changed, 20 insertions, 23 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 0f9723b1933..acfb08f0998 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.25 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: dispatch.c,v 1.26 2004/05/04 21:48:16 deraadt Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -146,7 +146,6 @@ dispatch(void)
struct pollfd *fds;
time_t howlong;
- nfds = 0;
for (l = protocols; l; l = l->next)
nfds++;
@@ -162,6 +161,7 @@ dispatch(void)
another:
if (timeouts) {
struct timeout *t;
+
if (timeouts->when <= cur_time) {
t = timeouts;
timeouts = timeouts->next;
@@ -187,6 +187,7 @@ another:
/* Set up the descriptors to be polled. */
for (i = 0, l = protocols; l; l = l->next) {
struct interface_info *ip = l->local;
+
if (ip && (l->handler != got_one || !ip->dead)) {
fds[i].fd = l->fd;
fds[i].events = POLLIN;
@@ -206,8 +207,7 @@ another:
if (errno == EAGAIN || errno == EINTR) {
time(&cur_time);
continue;
- }
- else
+ } else
error("poll: %m");
}
@@ -295,13 +295,14 @@ interface_status(struct interface_info *ifinfo)
syslog(LOG_ERR, "ioctl(SIOCGIFFLAGS) on %s: %m", ifname);
goto inactive;
}
+
/*
* if one of UP and RUNNING flags is dropped,
* the interface is not active.
*/
- if ((ifr.ifr_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
+ if ((ifr.ifr_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
goto inactive;
- }
+
/* Next, check carrier on the interface, if possible */
if (ifinfo->noifmedia)
goto active;
diff --git a/sbin/dhclient/inet.c b/sbin/dhclient/inet.c
index 00635aa2b4d..a52847596e1 100644
--- a/sbin/dhclient/inet.c
+++ b/sbin/dhclient/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.6 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: inet.c,v 1.7 2004/05/04 21:48:16 deraadt Exp $ */
/*
* Subroutines to manipulate internet addresses in a safely portable
@@ -73,8 +73,8 @@ subnet_number(struct iaddr addr, struct iaddr mask)
struct iaddr
broadcast_addr(struct iaddr subnet, struct iaddr mask)
{
- int i;
struct iaddr rv;
+ int i;
if (subnet.len != mask.len) {
rv.len = 0;
@@ -96,11 +96,12 @@ addr_eq(struct iaddr addr1, struct iaddr addr2)
return (memcmp(addr1.iabuf, addr2.iabuf, addr1.len) == 0);
}
-char *piaddr(struct iaddr addr)
+char *
+piaddr(struct iaddr addr)
{
static char pbuf[32];
- char *s;
struct in_addr a;
+ char *s;
memcpy(&a, &(addr.iabuf), sizeof(struct in_addr));
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index 4a6a50bdf2a..21a2116d8e2 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.8 2004/05/04 20:28:40 deraadt Exp $ */
+/* $OpenBSD: parse.c,v 1.9 2004/05/04 21:48:16 deraadt Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -60,9 +60,9 @@
void
skip_to_semi(FILE *cfile)
{
+ int brace_count = 0;
int token;
char *val;
- int brace_count = 0;
do {
token = peek_token(&val, cfile);
@@ -150,10 +150,9 @@ parse_ip_addr(FILE *cfile, struct iaddr *addr)
void
parse_hardware_param(FILE *cfile, struct hardware *hardware)
{
- char *val;
- int token;
- int hlen;
unsigned char *t;
+ int token, hlen;
+ char *val;
token = next_token(&val, cfile);
switch (token) {
@@ -239,11 +238,9 @@ unsigned char *
parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
int separator, int base, int size)
{
- char *val;
- int token;
unsigned char *bufp = buf, *s = NULL;
- char *t;
- int count = 0;
+ int token, count = 0;
+ char *val, *t;
pair c = NULL;
if (!bufp && *max) {
@@ -321,11 +318,9 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
void
convert_num(unsigned char *buf, char *str, int base, int size)
{
- char *ptr = str;
- int negative = 0;
+ int negative = 0, tval, max;
u_int32_t val = 0;
- int tval;
- int max;
+ char *ptr = str;
if (*ptr == '-') {
negative = 1;