summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2017-07-14 14:03:16 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2017-07-14 14:03:16 +0000
commit1fe5961886524581bf32c86ba96c18a049a4d955 (patch)
tree1ee1649cfd1dd124e9dee7535f44ab59577d7f6e
parentbd41775039a20052fca27a9debec77bf4aa6289f (diff)
Replace remaining "!<pointer>" expressions with
"<pointer> == NULL". And of course "<pointer>" expressions with "<pointer> != NULL".
-rw-r--r--sbin/dhclient/clparse.c8
-rw-r--r--sbin/dhclient/dhclient.c17
-rw-r--r--sbin/dhclient/kroute.c4
-rw-r--r--sbin/dhclient/options.c12
-rw-r--r--sbin/dhclient/parse.c4
5 files changed, 24 insertions, 21 deletions
diff --git a/sbin/dhclient/clparse.c b/sbin/dhclient/clparse.c
index dfd864e80f6..2fbf050df45 100644
--- a/sbin/dhclient/clparse.c
+++ b/sbin/dhclient/clparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clparse.c,v 1.122 2017/07/10 00:47:47 krw Exp $ */
+/* $OpenBSD: clparse.c,v 1.123 2017/07/14 14:03:15 krw Exp $ */
/* Parser for dhclient config and lease files. */
@@ -506,7 +506,7 @@ parse_client_lease_statement(FILE *cfile, char *name)
}
lease = calloc(1, sizeof(struct client_lease));
- if (!lease)
+ if (lease == NULL)
fatalx("no memory for lease.");
do {
@@ -759,7 +759,7 @@ parse_option_decl(FILE *cfile, struct option_data *options)
return -1;
options[code].data = malloc(hunkix + nul_term);
- if (!options[code].data)
+ if (options[code].data == NULL)
fatalx("out of memory allocating option data.");
memcpy(options[code].data, hunkbuf, hunkix + nul_term);
options[code].len = hunkix;
@@ -778,7 +778,7 @@ parse_reject_statement(FILE *cfile)
return;
elem = malloc(sizeof(struct reject_elem));
- if (!elem)
+ if (elem == NULL)
fatalx("no memory for reject address!");
elem->addr = addr;
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index ea85e30f0f7..c03da128bd4 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.467 2017/07/14 13:47:09 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.468 2017/07/14 14:03:15 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -660,7 +660,7 @@ main(int argc, char *argv[])
ifi->bfdesc = get_bpf_sock(ifi->name);
ifi->rbuf_max = configure_bpf_sock(ifi->bfdesc);
ifi->rbuf = malloc(ifi->rbuf_max);
- if (!ifi->rbuf)
+ if (ifi->rbuf == NULL)
fatalx("Can't allocate %lu bytes for bpf input buffer.",
(unsigned long)ifi->rbuf_max);
ifi->rbuf_offset = 0;
@@ -964,7 +964,7 @@ dhcpnak(struct interface_info *ifi, struct option_data *options, char *info)
return;
}
- if (!ifi->active) {
+ if (ifi->active == NULL) {
#ifdef DEBUG
log_debug("Unexpected %s. No active lease.", info);
#endif /* DEBUG */
@@ -1310,7 +1310,7 @@ packet_to_lease(struct interface_info *ifi, struct option_data *options)
!(lease->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) &&
packet->sname[0]) {
lease->server_name = malloc(DHCP_SNAME_LEN + 1);
- if (!lease->server_name) {
+ if (lease->server_name == NULL) {
log_warnx("lease declined:: no memory for SNAME.");
goto decline;
}
@@ -1328,7 +1328,7 @@ packet_to_lease(struct interface_info *ifi, struct option_data *options)
packet->file[0]) {
/* Don't count on the NUL terminator. */
lease->filename = malloc(DHCP_FILE_LEN + 1);
- if (!lease->filename) {
+ if (lease->filename == NULL) {
log_warnx("lease declined: no memory for filename.");
goto decline;
}
@@ -1579,8 +1579,8 @@ make_discover(struct interface_info *ifi, struct client_lease *lease)
/* Send any options requested in the config file. */
for (i = 0; i < DHO_COUNT; i++)
- if (!options[i].data &&
- config->send_options[i].data) {
+ if (options[i].data == NULL &&
+ config->send_options[i].data != NULL) {
options[i].data = config->send_options[i].data;
options[i].len = config->send_options[i].len;
}
@@ -1656,7 +1656,8 @@ make_request(struct interface_info *ifi, struct client_lease * lease)
/* Send any options requested in the config file. */
for (i = 0; i < DHO_COUNT; i++)
- if (!options[i].data && config->send_options[i].data) {
+ if (options[i].data == NULL &&
+ config->send_options[i].data != NULL) {
options[i].data = config->send_options[i].data;
options[i].len = config->send_options[i].len;
}
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index 5f8f750a25f..3df98ad2046 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.107 2017/07/10 14:11:47 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.108 2017/07/14 14:03:15 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -98,7 +98,7 @@ check_route_label(struct sockaddr_rtlabel *label)
{
pid_t pid;
- if (!label)
+ if (label == NULL)
return ROUTE_LABEL_NONE;
if (strncmp("DHCLIENT ", label->sr_label, 9) != 0)
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index 7b7c6ef4821..3998274b111 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.99 2017/07/10 00:47:47 krw Exp $ */
+/* $OpenBSD: options.c,v 1.100 2017/07/14 14:03:15 krw Exp $ */
/* DHCP options parsing and reassembly. */
@@ -455,8 +455,9 @@ parse_option_buffer(struct option_data *options, unsigned char *buffer,
* If we haven't seen this option before, just make
* space for it and copy it there.
*/
- if (!options[code].data) {
- if (!(t = calloc(1, len + 1)))
+ if (options[code].data == NULL) {
+ t = calloc(1, len + 1);
+ if (t == NULL)
fatalx("Can't allocate storage for option %s.",
name);
/*
@@ -473,7 +474,7 @@ parse_option_buffer(struct option_data *options, unsigned char *buffer,
* we last saw.
*/
t = calloc(1, len + options[code].len + 1);
- if (!t)
+ if (t == NULL)
fatalx("Can't expand storage for option %s.",
name);
memcpy(t, options[code].data, options[code].len);
@@ -510,7 +511,8 @@ pack_options(unsigned char *buf, int buflen, struct option_data *options)
bufix = 4;
for (code = DHO_SUBNET_MASK; code < DHO_END; code++) {
- if (!options[code].data || code == DHO_DHCP_MESSAGE_TYPE)
+ if (options[code].data == NULL ||
+ code == DHO_DHCP_MESSAGE_TYPE)
continue;
length = options[code].len;
diff --git a/sbin/dhclient/parse.c b/sbin/dhclient/parse.c
index 61e0630c93a..d88041614f1 100644
--- a/sbin/dhclient/parse.c
+++ b/sbin/dhclient/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.58 2017/07/10 00:47:47 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.59 2017/07/14 14:03:15 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
@@ -149,7 +149,7 @@ parse_string(FILE *cfile, unsigned int *len)
return NULL;
}
s = malloc(i+1);
- if (!s)
+ if (s == NULL)
fatalx("no memory for string %s.", val);
memcpy(s, unvisbuf, i+1); /* copy terminating NUL */
if (len != NULL)