Module Name: src
Committed By: lukem
Date: Thu Apr 16 06:27:43 UTC 2009
Modified Files:
src/usr.sbin/bad144: Makefile bad144.c
Log Message:
Fix -Wsign-compare issues
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/bad144/Makefile
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/bad144/bad144.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/bad144/Makefile
diff -u src/usr.sbin/bad144/Makefile:1.10 src/usr.sbin/bad144/Makefile:1.11
--- src/usr.sbin/bad144/Makefile:1.10 Sat Feb 14 13:56:41 2009
+++ src/usr.sbin/bad144/Makefile Thu Apr 16 06:27:43 2009
@@ -1,12 +1,11 @@
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $NetBSD: Makefile,v 1.10 2009/02/14 13:56:41 abs Exp $
+# $NetBSD: Makefile,v 1.11 2009/04/16 06:27:43 lukem Exp $
.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "i386"
PROG= bad144
.endif
DPADD+= ${LIBUTIL}
LDADD+= -lutil
-WARNS= 2
MAN= bad144.8
Index: src/usr.sbin/bad144/bad144.c
diff -u src/usr.sbin/bad144/bad144.c:1.26 src/usr.sbin/bad144/bad144.c:1.27
--- src/usr.sbin/bad144/bad144.c:1.26 Mon Jul 21 13:36:57 2008
+++ src/usr.sbin/bad144/bad144.c Thu Apr 16 06:27:43 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: bad144.c,v 1.26 2008/07/21 13:36:57 lukem Exp $ */
+/* $NetBSD: bad144.c,v 1.27 2009/04/16 06:27:43 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1988, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)bad144.c 8.2 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: bad144.c,v 1.26 2008/07/21 13:36:57 lukem Exp $");
+__RCSID("$NetBSD: bad144.c,v 1.27 2009/04/16 06:27:43 lukem Exp $");
#endif
#endif /* not lint */
@@ -283,7 +283,7 @@
i = 0;
else
i = badfile * 2;
- for (; i < 10 && i < dp->d_nsectors; i += 2) {
+ for (; i < 10 && i < (int)dp->d_nsectors; i += 2) {
if (lseek(f,
(off_t)(dp->d_secsize * (size - dp->d_nsectors + i)),
SEEK_SET) < 0)
@@ -328,11 +328,11 @@
i = 0;
else
i = badfile * 2;
- for (; i < 10 && i < dp->d_nsectors; i += 2) {
+ for (; i < 10 && i < (int)dp->d_nsectors; i += 2) {
sn = size - dp->d_nsectors + i;
if (lseek(f, (off_t)(sn * dp->d_secsize), SEEK_SET) < 0)
err(4, "lseek");
- if (read(f, (char *) bad, dp->d_secsize) == dp->d_secsize) {
+ if ((size_t)read(f, (char *) bad, dp->d_secsize) == dp->d_secsize) {
if (i > 0)
printf("Using bad-sector file %d\n", i/2);
return(sn);
@@ -449,10 +449,10 @@
for (tries = 0; tries < RETRIES; tries++) {
if (lseek(f, (off_t)(dp->d_secsize * s1), SEEK_SET) < 0)
err(4, "lseek");
- if ((n = read(f, buf, dp->d_secsize)) == dp->d_secsize)
+ if ((size_t)(n = read(f, buf, dp->d_secsize)) == dp->d_secsize)
break;
}
- if (n != dp->d_secsize) {
+ if ((size_t)n != dp->d_secsize) {
if (n < 0)
err(4, "can't read sector, %lld", (long long)s1);
else
@@ -463,7 +463,7 @@
err(4, "lseek");
if (verbose)
printf("copying %lld to %lld\n", (long long)s1, (long long)s2);
- if (nflag == 0 && write(f, buf, dp->d_secsize) != dp->d_secsize) {
+ if (nflag == 0 && (size_t)write(f, buf, dp->d_secsize) != dp->d_secsize) {
warn("can't write replacement sector, %lld", (long long)s2);
return(0);
}
@@ -484,7 +484,7 @@
}
if (verbose)
printf("zeroing %lld\n", (long long)sn);
- if (nflag == 0 && write(f, zbuf, dp->d_secsize) != dp->d_secsize)
+ if (nflag == 0 && (size_t)write(f, zbuf, dp->d_secsize) != dp->d_secsize)
warn("can't write replacement sector, %lld",
(long long)sn);
free(zbuf);