Module Name: src
Committed By: lukem
Date: Wed Apr 15 00:23:29 UTC 2009
Modified Files:
src/usr.sbin/bootp/bootpd: bootpd.c
src/usr.sbin/bootp/bootpef: bootpef.c
src/usr.sbin/bootp/bootpgw: bootpgw.c
src/usr.sbin/bootp/bootptest: bootptest.c getether.c print-bootp.c
src/usr.sbin/bootp/common: hwaddr.c hwaddr.h readfile.c
Log Message:
Fix -Wsign-compare issues
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/bootp/bootpd/bootpd.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/bootp/bootpef/bootpef.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/bootp/bootpgw/bootpgw.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/bootp/bootptest/bootptest.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/bootp/bootptest/getether.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bootp/bootptest/print-bootp.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bootp/common/hwaddr.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bootp/common/hwaddr.h
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/bootp/common/readfile.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/bootp/bootpd/bootpd.c
diff -u src/usr.sbin/bootp/bootpd/bootpd.c:1.22 src/usr.sbin/bootp/bootpd/bootpd.c:1.23
--- src/usr.sbin/bootp/bootpd/bootpd.c:1.22 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/bootpd/bootpd.c Wed Apr 15 00:23:28 2009
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bootpd.c,v 1.22 2008/05/02 19:22:10 xtraeme Exp $");
+__RCSID("$NetBSD: bootpd.c,v 1.23 2009/04/15 00:23:28 lukem Exp $");
#endif
/*
@@ -519,7 +519,7 @@
report(LOG_INFO, "recvd pkt from IP addr %s",
inet_ntoa(recv_addr.sin_addr));
}
- if (n < sizeof(struct bootp)) {
+ if (n < (int)sizeof(struct bootp)) {
if (debug) {
report(LOG_INFO, "received short packet");
}
@@ -1224,7 +1224,7 @@
* a response of that same length where the additional length
* is assumed to be part of the bp_vend (options) area.
*/
- if (pktlen > sizeof(*bp)) {
+ if (pktlen > (int)sizeof(*bp)) {
if (debug > 1)
report(LOG_INFO, "request message length=%d", pktlen);
}
@@ -1265,7 +1265,7 @@
p += llen;
}
- if (msgsz > sizeof(*bp)) {
+ if (msgsz > (int)sizeof(*bp)) {
if (debug > 1)
report(LOG_INFO, "request has DHCP msglen=%d", msgsz);
pktlen = msgsz;
@@ -1273,12 +1273,12 @@
}
}
- if (pktlen < sizeof(*bp)) {
+ if (pktlen < (int)sizeof(*bp)) {
report(LOG_ERR, "invalid response length=%d", pktlen);
pktlen = sizeof(*bp);
}
bytesleft = ((byte*)bp + pktlen) - vp;
- if (pktlen > sizeof(*bp)) {
+ if (pktlen > (int)sizeof(*bp)) {
if (debug > 1)
report(LOG_INFO, "extended reply, length=%d, options=%d",
pktlen, bytesleft);
@@ -1304,7 +1304,7 @@
if (hp->flags.bootsize) {
/* always enough room here */
bootsize = (hp->flags.bootsize_auto) ?
- ((bootsize + 511) / 512) : (hp->bootsize); /* Round up */
+ ((bootsize + 511) / 512) : ((int32_t)hp->bootsize); /* Round up */
*vp++ = TAG_BOOT_SIZE;
*vp++ = 2;
*vp++ = (byte) ((bootsize >> 8) & 0xFF);
Index: src/usr.sbin/bootp/bootpef/bootpef.c
diff -u src/usr.sbin/bootp/bootpef/bootpef.c:1.8 src/usr.sbin/bootp/bootpef/bootpef.c:1.9
--- src/usr.sbin/bootp/bootpef/bootpef.c:1.8 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/bootpef/bootpef.c Wed Apr 15 00:23:28 2009
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bootpef.c,v 1.8 2008/05/02 19:22:10 xtraeme Exp $");
+__RCSID("$NetBSD: bootpef.c,v 1.9 2009/04/15 00:23:28 lukem Exp $");
#endif
@@ -306,7 +306,7 @@
return;
}
len = vp - buffer;
- if (len != fwrite(buffer, 1, len, fp)) {
+ if ((size_t)len != fwrite(buffer, 1, len, fp)) {
report(LOG_ERR, "write failed on \"%s\" : %s",
hp->exten_file->string, get_errmsg());
}
Index: src/usr.sbin/bootp/bootpgw/bootpgw.c
diff -u src/usr.sbin/bootp/bootpgw/bootpgw.c:1.13 src/usr.sbin/bootp/bootpgw/bootpgw.c:1.14
--- src/usr.sbin/bootp/bootpgw/bootpgw.c:1.13 Sun May 27 16:31:42 2007
+++ src/usr.sbin/bootp/bootpgw/bootpgw.c Wed Apr 15 00:23:28 2009
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bootpgw.c,v 1.13 2007/05/27 16:31:42 tls Exp $");
+__RCSID("$NetBSD: bootpgw.c,v 1.14 2009/04/15 00:23:28 lukem Exp $");
#endif
/*
@@ -449,7 +449,7 @@
report(LOG_INFO, "recvd pkt from IP addr %s",
inet_ntoa(clnt_addr.sin_addr));
}
- if (n < sizeof(struct bootp)) {
+ if (n < (int)sizeof(struct bootp)) {
if (debug) {
report(LOG_INFO, "received short packet");
}
Index: src/usr.sbin/bootp/bootptest/bootptest.c
diff -u src/usr.sbin/bootp/bootptest/bootptest.c:1.17 src/usr.sbin/bootp/bootptest/bootptest.c:1.18
--- src/usr.sbin/bootp/bootptest/bootptest.c:1.17 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/bootptest/bootptest.c Wed Apr 15 00:23:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: bootptest.c,v 1.17 2008/05/02 19:22:10 xtraeme Exp $ */
+/* $NetBSD: bootptest.c,v 1.18 2009/04/15 00:23:29 lukem Exp $ */
/*
* bootptest.c - Test out a bootp server.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: bootptest.c,v 1.17 2008/05/02 19:22:10 xtraeme Exp $");
+__RCSID("$NetBSD: bootptest.c,v 1.18 2009/04/15 00:23:29 lukem Exp $");
#endif
const char *usage = "usage: %s [-f bootfile] [-h] [-m magic_number] server-name\n"
@@ -407,7 +407,7 @@
if (n <= 0) {
continue;
}
- if (n < sizeof(struct bootp)) {
+ if (n < (int)sizeof(struct bootp)) {
printf("received short packet\n");
continue;
}
Index: src/usr.sbin/bootp/bootptest/getether.c
diff -u src/usr.sbin/bootp/bootptest/getether.c:1.8 src/usr.sbin/bootp/bootptest/getether.c:1.9
--- src/usr.sbin/bootp/bootptest/getether.c:1.8 Sun May 27 16:31:42 2007
+++ src/usr.sbin/bootp/bootptest/getether.c Wed Apr 15 00:23:29 2009
@@ -1,8 +1,8 @@
-/* $NetBSD: getether.c,v 1.8 2007/05/27 16:31:42 tls Exp $ */
+/* $NetBSD: getether.c,v 1.9 2009/04/15 00:23:29 lukem Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: getether.c,v 1.8 2007/05/27 16:31:42 tls Exp $");
+__RCSID("$NetBSD: getether.c,v 1.9 2009/04/15 00:23:29 lukem Exp $");
#endif
/*
@@ -141,7 +141,7 @@
ifc.ifc_len = sizeof(ibuf);
ifc.ifc_buf = (caddr_t) ibuf;
if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0 ||
- ifc.ifc_len < sizeof(struct ifreq)) {
+ ifc.ifc_len < (int)sizeof(struct ifreq)) {
report(LOG_ERR, "getether: SIOCGIFCONF: %s", get_errmsg());
goto out;
}
@@ -159,7 +159,7 @@
}
/* Bump interface config pointer */
n = ifrp->ifr_addr.sa_len + sizeof(ifrp->ifr_name);
- if (n < sizeof(*ifrp))
+ if (n < (int)sizeof(*ifrp))
n = sizeof(*ifrp);
ifrp = (struct ifreq *) ((char *) ifrp + n);
}
Index: src/usr.sbin/bootp/bootptest/print-bootp.c
diff -u src/usr.sbin/bootp/bootptest/print-bootp.c:1.9 src/usr.sbin/bootp/bootptest/print-bootp.c:1.10
--- src/usr.sbin/bootp/bootptest/print-bootp.c:1.9 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/bootptest/print-bootp.c Wed Apr 15 00:23:29 2009
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: print-bootp.c,v 1.9 2008/05/02 19:22:10 xtraeme Exp $");
+__RCSID("$NetBSD: print-bootp.c,v 1.10 2009/04/15 00:23:29 lukem Exp $");
/* 93/10/10 <[email protected]> New data-driven option print routine. */
#endif
@@ -380,7 +380,7 @@
printf("-cmu");
v = (struct cmu_vend *) bp;
- if (length < sizeof(*v)) {
+ if (length < (int)sizeof(*v)) {
printf(" |L=%d", length);
return;
}
Index: src/usr.sbin/bootp/common/hwaddr.c
diff -u src/usr.sbin/bootp/common/hwaddr.c:1.9 src/usr.sbin/bootp/common/hwaddr.c:1.10
--- src/usr.sbin/bootp/common/hwaddr.c:1.9 Sun May 27 16:31:42 2007
+++ src/usr.sbin/bootp/common/hwaddr.c Wed Apr 15 00:23:29 2009
@@ -1,8 +1,8 @@
-/* $NetBSD: hwaddr.c,v 1.9 2007/05/27 16:31:42 tls Exp $ */
+/* $NetBSD: hwaddr.c,v 1.10 2009/04/15 00:23:29 lukem Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: hwaddr.c,v 1.9 2007/05/27 16:31:42 tls Exp $");
+__RCSID("$NetBSD: hwaddr.c,v 1.10 2009/04/15 00:23:29 lukem Exp $");
#endif
/*
@@ -59,7 +59,7 @@
{6, "IEEE 802"}, /* Type 6: IEEE 802 Networks */
{0, "ARCNET"} /* Type 7: ARCNET */
};
-int hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]);
+size_t hwinfocnt = sizeof(hwinfolist) / sizeof(hwinfolist[0]);
/*
Index: src/usr.sbin/bootp/common/hwaddr.h
diff -u src/usr.sbin/bootp/common/hwaddr.h:1.5 src/usr.sbin/bootp/common/hwaddr.h:1.6
--- src/usr.sbin/bootp/common/hwaddr.h:1.5 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/common/hwaddr.h Wed Apr 15 00:23:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: hwaddr.h,v 1.5 2008/05/02 19:22:10 xtraeme Exp $ */
+/* $NetBSD: hwaddr.h,v 1.6 2009/04/15 00:23:29 lukem Exp $ */
/* hwaddr.h */
#ifndef HWADDR_H
@@ -17,7 +17,7 @@
};
extern struct hwinfo hwinfolist[];
-extern int hwinfocnt;
+extern size_t hwinfocnt;
extern void setarp(int, struct in_addr *, u_char *, int);
extern char *haddrtoa(u_char *, int);
Index: src/usr.sbin/bootp/common/readfile.c
diff -u src/usr.sbin/bootp/common/readfile.c:1.16 src/usr.sbin/bootp/common/readfile.c:1.17
--- src/usr.sbin/bootp/common/readfile.c:1.16 Fri May 2 19:22:10 2008
+++ src/usr.sbin/bootp/common/readfile.c Wed Apr 15 00:23:29 2009
@@ -22,7 +22,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: readfile.c,v 1.16 2008/05/02 19:22:10 xtraeme Exp $");
+__RCSID("$NetBSD: readfile.c,v 1.17 2009/04/15 00:23:29 lukem Exp $");
#endif
@@ -495,7 +495,8 @@
PRIVATE void
read_entry(FILE *fp, char *buffer, unsigned int *bufsiz)
{
- int c, length;
+ int c;
+ unsigned int length;
length = 0;