Date: Mon, 26 Oct 2009 19:11:40 +0100 (CET) From: Ulrich Spörlein <uqs@spoerlein.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/139994: fsirand(8): increase to WARNS=2 Message-ID: <200910261811.n9QIBeFn055078@roadrunner.spoerlein.net> Resent-Message-ID: <200910261820.n9QIK1XI021518@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 139994 >Category: bin >Synopsis: fsirand(8): increase to WARNS=2 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Oct 26 18:20:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Ulrich Spörlein >Release: FreeBSD 9.0-CURRENT i386 >Organization: >Environment: >Description: Done by casting data types for printf(3) calls. Higher warns are tricky due to signed/unsigned comparisons. >How-To-Repeat: >Fix: --- fsirand.diff begins here --- diff -r dabb79c85f13 -r c12ebdc97282 sbin/fsirand/Makefile --- a/sbin/fsirand/Makefile Fri Oct 23 10:34:06 2009 +0200 +++ b/sbin/fsirand/Makefile Mon Oct 26 19:07:40 2009 +0100 @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= fsirand -WARNS?= 0 +WARNS?= 2 MAN= fsirand.8 DPADD= ${LIBUTIL} LDADD= -lutil diff -r dabb79c85f13 -r c12ebdc97282 sbin/fsirand/fsirand.c --- a/sbin/fsirand/fsirand.c Fri Oct 23 10:34:06 2009 +0200 +++ b/sbin/fsirand/fsirand.c Mon Oct 26 19:07:40 2009 +0100 @@ -47,6 +47,7 @@ #include <errno.h> #include <fcntl.h> #include <stdio.h> +#include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -141,8 +142,8 @@ for (i = 0; sblock_try[i] != -1; i++) { sblockloc = sblock_try[i]; if (lseek(devfd, sblockloc, SEEK_SET) == -1) { - warn("can't seek to superblock (%qd) on %s", - sblockloc, device); + warn("can't seek to superblock (%jd) on %s", + (intmax_t)sblockloc, device); return (1); } if ((n = read(devfd, (void *)sblock, SBLOCKSIZE))!=SBLOCKSIZE) { @@ -178,7 +179,7 @@ for (cg = 0; cg < sblock->fs_ncg; cg++) { dblk = fsbtodb(sblock, cgsblock(sblock, cg)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, (void *)sblock, SBLOCKSIZE)) != SBLOCKSIZE) { warn("can't read backup superblock %d on %s: %s", @@ -223,8 +224,8 @@ sblock->fs_id[1] = random(); if (lseek(devfd, sblockloc, SEEK_SET) == -1) { - warn("can't seek to superblock (%qd) on %s", sblockloc, - device); + warn("can't seek to superblock (%jd) on %s", + (intmax_t)sblockloc, device); return (1); } if ((n = write(devfd, (void *)sblock, SBLOCKSIZE)) != @@ -241,7 +242,8 @@ if (!printonly) { dblk = fsbtodb(sblock, cgsblock(sblock, cg)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", + (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, (void *)sblock, SBLOCKSIZE)) != SBLOCKSIZE) { @@ -255,7 +257,7 @@ /* Read in inodes, then print or randomize generation nums */ dblk = fsbtodb(sblock, ino_to_fsba(sblock, inumber)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", (intmax_t)dblk * bsize); return (1); } else if ((n = read(devfd, inodebuf, ibufsize)) != ibufsize) { warnx("can't read inodes: %s", @@ -270,10 +272,10 @@ dp2 = &((struct ufs2_dinode *)inodebuf)[n]; if (inumber >= ROOTINO) { if (printonly) - (void)printf("ino %d gen %qx\n", + (void)printf("ino %d gen %x\n", inumber, sblock->fs_magic == FS_UFS1_MAGIC ? - (quad_t)dp1->di_gen : dp2->di_gen); + dp1->di_gen : dp2->di_gen); else if (sblock->fs_magic == FS_UFS1_MAGIC) dp1->di_gen = random(); else @@ -284,8 +286,8 @@ /* Write out modified inodes */ if (!printonly) { if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", - (off_t)dblk * bsize); + warn("can't seek to %jd", + (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, inodebuf, ibufsize)) != ibufsize) { --- fsirand.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910261811.n9QIBeFn055078>