badsect warns

Giorgos Keramidas <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
The following enables compiling badsect with WARNS=6.
There seems to be something funny about fs->fs_size though.
In <ufs/ffs/fs.h> it's not daddr_t but `long'.
This is why it triggers the warning now that the cast to
`unsigned' (which is there since revision 1.1 of badsect.c)
doesn't match the signed type of fs->fs_size.

Is there some reason that this is cast to `unsigned'?

If not, should we remove the cast and start building badsect with
something more strict than WARNS=0?

- Giorgos

%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/badsect/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile	4 Dec 2001 02:19:44 -0000	1.5
+++ Makefile	8 Jun 2002 23:55:54 -0000
@@ -2,7 +2,7 @@
 # $FreeBSD: src/sbin/badsect/Makefile,v 1.5 2001/12/04 02:19:44 obrien Exp $
 
 PROG=	badsect
-WARNS=	0
+WARNS=	6
 MAN=	badsect.8
 
 .include <bsd.prog.mk>
Index: badsect.c
===================================================================
RCS file: /home/ncvs/src/sbin/badsect/badsect.c,v
retrieving revision 1.13
diff -u -r1.13 badsect.c
--- badsect.c	16 May 2002 04:09:51 -0000	1.13
+++ badsect.c	9 Jun 2002 01:00:54 -0000
@@ -168,7 +168,7 @@
 	daddr_t fsbn, bn;
 
 	fsbn = dbtofsb(fs, blkno);
-	if ((unsigned)(fsbn+cnt) > fs->fs_size) {
+	if ((fsbn + cnt) > fs->fs_size) {
 		printf("block %ld out of range of filesystem\n", (long)blkno);
 		return (1);
 	}
%%%

To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.