win.
No intentional functional change.
-# $OpenBSD: Makefile,v 1.18 2017/04/06 22:41:39 krw Exp $
+# $OpenBSD: Makefile,v 1.19 2017/04/09 20:44:13 krw Exp $
#
# Copyright (c) 1996, 1997 The Internet Software Consortium.
# All rights reserved.
CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes
CFLAGS+=-Wmissing-declarations
CFLAGS+=-Wshadow -Wpointer-arith -Wcast-qual
+CFLAGS+=-Wsign-compare
.include <bsd.prog.mk>
-/* $OpenBSD: conflex.c,v 1.37 2017/04/08 20:16:04 krw Exp $ */
+/* $OpenBSD: conflex.c,v 1.38 2017/04/09 20:44:13 krw Exp $ */
/* Lexical scanner for dhclient config file. */
lpos = 1;
cur_line[0] = 0;
} else if (c != EOF) {
- if (lpos < sizeof(line1)) {
+ if ((unsigned int)lpos < sizeof(line1)) {
cur_line[lpos - 1] = c;
cur_line[lpos] = 0;
}
-/* $OpenBSD: dhclient.c,v 1.410 2017/04/08 20:16:04 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.411 2017/04/09 20:44:13 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
do {
n = read(routefd, rtmmsg, 2048);
} while (n == -1 && errno == EINTR);
+ if (n == -1)
+ goto done;
rtm = (struct rt_msghdr *)rtmmsg;
- if (n < sizeof(rtm->rtm_msglen) || n < rtm->rtm_msglen ||
+ if ((size_t)n < sizeof(rtm->rtm_msglen) || n < rtm->rtm_msglen ||
rtm->rtm_version != RTM_VERSION)
goto done;
rtm->rtm_priority != RTP_PROPOSAL_DHCLIENT)
goto done;
if ((rtm->rtm_flags & RTF_PROTO3) != 0) {
- if (rtm->rtm_seq == client->xid) {
+ if (rtm->rtm_seq == (int32_t)client->xid) {
client->flags |= IN_CHARGE;
goto done;
} else if ((client->flags & IN_CHARGE) != 0) {
} else if (fstat(tailfd, &sb) == -1) {
fatal("Cannot stat /etc/resolv.conf.tail");
} else {
- if (sb.st_size > 0 && sb.st_size < SIZE_MAX) {
+ if (sb.st_size > 0 && sb.st_size < LLONG_MAX) {
config->resolv_tail = calloc(1, sb.st_size + 1);
if (config->resolv_tail == NULL) {
fatalx("no memory for resolv.conf.tail "
n = write(fd, contents, sz);
if (n == -1)
log_warn("Couldn't write contents to '%s'", path);
- else if (n < sz)
+ else if ((size_t)n < sz)
log_warnx("Short contents write to '%s' (%zd vs %zu)", path,
n, sz);
-/* $OpenBSD: kroute.c,v 1.87 2017/04/08 20:16:04 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.88 2017/04/09 20:44:13 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
len = snprintf(label->sr_label, sizeof(label->sr_label), "DHCLIENT %d",
(int)getpid());
- if (len == -1) {
- log_warn("creating route label");
- return (1);
- }
-
- if (len >= sizeof(label->sr_label)) {
- log_warnx("creating route label: label too long (%d vs %zu)",
- len, sizeof(label->sr_label));
+ if (len == -1 || (unsigned int)len >= sizeof(label->sr_label)) {
+ log_warn("could not create route label");
return (1);
}
-/* $OpenBSD: options.c,v 1.87 2017/04/08 20:16:04 krw Exp $ */
+/* $OpenBSD: options.c,v 1.88 2017/04/09 20:44:13 krw Exp $ */
/* DHCP options parsing and reassembly. */
bytes > sizeof(net.s_addr))
return (NULL);
rslt = snprintf(bitsbuf, sizeof(bitsbuf), "/%d ", bits);
- if (rslt == -1 || rslt >= sizeof(bitsbuf))
+ if (rslt == -1 || (unsigned int)rslt >= sizeof(bitsbuf))
return (NULL);
memset(&net, 0, sizeof(net));
strlcat(string, ", ", sizeof(string));
strlcat(string, inet_ntoa(net), sizeof(string));
strlcat(string, bitsbuf, sizeof(string));
- rslt = strlcat(string, inet_ntoa(gateway), sizeof(string));
- if (rslt >= sizeof(string))
+ if (strlcat(string, inet_ntoa(gateway), sizeof(string)) >=
+ sizeof(string))
return (NULL);
}
-/* $OpenBSD: parse.c,v 1.49 2017/04/08 20:16:04 krw Exp $ */
+/* $OpenBSD: parse.c,v 1.50 2017/04/09 20:44:13 krw Exp $ */
/* Common parser code for dhcpd and dhclient. */
log_warnx("%s line %d: %s", tlname, lexline, msg);
log_warnx("%s", token_line);
- if (lexchar < sizeof(spaces)) {
+ if ((unsigned int)lexchar < sizeof(spaces)) {
memset(spaces, 0, sizeof(spaces));
- for (i = 0; i < lexchar - 1; i++) {
+ for (i = 0; (int)i < lexchar - 1; i++) {
if (token_line[i] == '\t')
spaces[i] = '\t';
else