Date: Wed, 26 Jun 2002 02:49:58 +0200 (CEST) From: Dan Lukes <dan@obluda.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/39865: cleaning sbin/fsck code from some warnings Message-ID: <200206260049.g5Q0nwan056322@obluda.cz>
next in thread | raw e-mail | index | archive | help
>Number: 39865
>Category: bin
>Synopsis: cleaning sbin/fsck code from some warnings
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 25 18:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Dan Lukes
>Release: FreeBSD 4.6-STABLE i386
>Organization:
Obludarium
>Environment:
System: FreeBSD xkulesh.vol.cz 4.6-STABLE FreeBSD
src/sbin/fsck/dir.c,v 1.15 1999/08/28 00:12:45
src/sbin/fsck/inode.c,v 1.20 2000/02/28 20:02:41
src/sbin/fsck/main.c,v 1.21.2.1 2001/01/23 23:11:07
src/sbin/fsck/pass2.c,v 1.10.2.2 2001/11/24 15:14:59
src/sbin/fsck/pass3.c,v 1.7.2.1 2001/01/23 23:11:07
src/sbin/fsck/pass5.c,v 1.17.2.1 2001/01/23 23:11:07
src/sbin/fsck/preen.c,v 1.16 1999/12/30 16:32:40
>Description:
sbin/fsck/dir.c: In function `dirscan':
127: warning: comparison between signed and unsigned
dsize is initialized from d_reclen which is unsigned int
it is never used with signed context, so it can be declared as
unsigned int
sbin/fsck/inode.c: In function `chkrange':
250: warning: long int format, ufs_daddr_t arg (arg 2)
250: warning: long int format, int arg (arg 3)
250: warning: long int format, int arg (arg 4)
fragnum() and cnt is int
blk is ufs_daddr_t e.g. int32_t e.g. int
sbin/fsck/main.c:
376: warning: implicit declaration of function `strerror'
411: warning: implicit declaration of function `strcat'
we should include strings.h
sbin/fsck/pass2.c: In function `pass2':
140: warning: int format, long int arg (arg 4)
140: warning: int format, long int arg (arg 5)
inplast is declared as long
sbin/fsck/pass3.c: In function `pass3':
65: warning: int format, long int arg (arg 3)
65: warning: int format, long int arg (arg 4)
65: warning: int format, long int arg (arg 5)
inplast is declared as long
sbin/fsck/pass5.c: In function `pass5':
95: warning: comparison between signed and unsigned
fs_bsize is int32_t CGINFO() is sizeof(...)
235: warning: comparison between signed and unsigned
242: warning: comparison between signed and unsigned
i,j are long; ROOTINO is ino_t e.g. u_int32_t
sbin/fsck/preen.c: In function `blockcheck':
296: warning: unused variable `raw'
295: warning: unused variable `stchar'
295: warning: unused variable `stslash'
those variables are really unused
>How-To-Repeat:
N/A
>Fix:
--- src/sbin/fsck/dir.c.ORIG Sat Aug 28 02:12:45 1999
+++ src/sbin/fsck/dir.c Wed Jun 26 02:06:23 2002
@@ -107,7 +107,8 @@
{
register struct direct *dp;
register struct bufarea *bp;
- int dsize, n;
+ unsigned int dsize;
+ int n;
long blksiz;
char dbuf[DIRBLKSIZ];
--- src/sbin/fsck/inode.c.ORIG Mon Feb 28 21:02:41 2000
+++ src/sbin/fsck/inode.c Wed Jun 26 02:12:07 2002
@@ -246,7 +246,7 @@
if (cnt > sblock.fs_frag ||
fragnum(&sblock, blk) + cnt > sblock.fs_frag) {
if (debug)
- printf("bad size: blk %ld, offset %ld, size %ld\n",
+ printf("bad size: blk %d, offset %d, size %d\n",
blk, fragnum(&sblock, blk), cnt);
return (1);
}
--- src/sbin/fsck/main.c.ORIG Wed Jan 24 03:18:00 2001
+++ src/sbin/fsck/main.c Wed Jun 26 02:18:04 2002
@@ -59,6 +59,7 @@
#include <errno.h>
#include <fstab.h>
#include <paths.h>
+#include <strings.h>
#include "fsck.h"
--- src/sbin/fsck/pass2.c.ORIG Sun Nov 25 17:33:56 2001
+++ src/sbin/fsck/pass2.c Wed Jun 26 02:23:21 2002
@@ -135,7 +135,7 @@
inpend = &inpsort[inplast];
for (inpp = inpsort; inpp < inpend; inpp++) {
if (got_siginfo) {
- printf("%s: phase 2: dir %d of %d (%d%%)\n", cdevname,
+ printf("%s: phase 2: dir %d of %ld (%ld%%)\n", cdevname,
inpp - inpsort, inplast, (inpp - inpsort) * 100 /
inplast);
got_siginfo = 0;
--- src/sbin/fsck/pass3.c.ORIG Wed Jan 24 03:18:00 2001
+++ src/sbin/fsck/pass3.c Wed Jun 26 02:26:38 2002
@@ -60,7 +60,7 @@
for (inpindex = inplast - 1; inpindex >= 0; inpindex--) {
if (got_siginfo) {
- printf("%s: phase 3: dir %d of %d (%d%%)\n", cdevname,
+ printf("%s: phase 3: dir %ld of %ld (%ld%%)\n", cdevname,
inplast - inpindex - 1, inplast,
(inplast - inpindex - 1) * 100 / inplast);
got_siginfo = 0;
--- src/sbin/fsck/pass5.c.ORIG Wed Jan 24 03:18:00 2001
+++ src/sbin/fsck/pass5.c Wed Jun 26 02:38:08 2002
@@ -92,7 +92,7 @@
i = fs->fs_contigsumsize;
fs->fs_contigsumsize =
MIN(fs->fs_maxcontig, FS_MAXCONTIG);
- if (CGSIZE(fs) > fs->fs_bsize) {
+ if ((int32_t)CGSIZE(fs) > fs->fs_bsize) {
pwarn("CANNOT %s CLUSTER MAPS\n", doit);
fs->fs_contigsumsize = i;
} else if (preen ||
@@ -232,14 +232,14 @@
break;
default:
- if (j < ROOTINO)
+ if ((ino_t)j < ROOTINO)
break;
errx(EEXIT, "BAD STATE %d FOR INODE I=%ld",
inoinfo(j)->ino_state, j);
}
}
if (c == 0)
- for (i = 0; i < ROOTINO; i++) {
+ for (i = 0; (ino_t)i < ROOTINO; i++) {
setbit(cg_inosused(newcg), i);
newcg->cg_cs.cs_nifree--;
}
--- src/sbin/fsck/preen.c.ORIG Thu Dec 30 17:32:40 1999
+++ src/sbin/fsck/preen.c Wed Jun 26 02:40:28 2002
@@ -292,8 +292,8 @@
blockcheck(origname)
char *origname;
{
- struct stat stslash, stblock, stchar;
- char *newname, *raw;
+ struct stat stblock;
+ char *newname;
struct fstab *fsinfo;
int retried = 0, len;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206260049.g5Q0nwan056322>
