Date: Mon, 17 Oct 2016 22:33:29 +0000 (UTC) From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r307535 - stable/11/sbin/fsck_ffs Message-ID: <201610172233.u9HMXTMW061029@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mckusick Date: Mon Oct 17 22:33:29 2016 New Revision: 307535 URL: https://svnweb.freebsd.org/changeset/base/307535 Log: MFC 304438: Fsck_ufs was using an int rather than a ufs2_daddr_t to store the alternate superblock location when given in the -b option. Modified: stable/11/sbin/fsck_ffs/fsck.h stable/11/sbin/fsck_ffs/globs.c stable/11/sbin/fsck_ffs/main.c stable/11/sbin/fsck_ffs/setup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/11/sbin/fsck_ffs/fsck.h Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/fsck.h Mon Oct 17 22:33:29 2016 (r307535) @@ -305,7 +305,7 @@ extern u_int real_dev_bsize; /* actual extern char nflag; /* assume a no response */ extern char yflag; /* assume a yes response */ extern int bkgrdflag; /* use a snapshot to run on an active system */ -extern int bflag; /* location of alternate super block */ +extern ufs2_daddr_t bflag; /* location of alternate super block */ extern int debug; /* output debugging info */ extern int Eflag; /* delete empty data blocks */ extern int Zflag; /* zero empty data blocks */ Modified: stable/11/sbin/fsck_ffs/globs.c ============================================================================== --- stable/11/sbin/fsck_ffs/globs.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/globs.c Mon Oct 17 22:33:29 2016 (r307535) @@ -77,7 +77,7 @@ u_int real_dev_bsize; /* actual disk se char nflag; /* assume a no response */ char yflag; /* assume a yes response */ int bkgrdflag; /* use a snapshot to run on an active system */ -int bflag; /* location of alternate super block */ +ufs2_daddr_t bflag; /* location of alternate super block */ int debug; /* output debugging info */ int Eflag; /* delete empty data blocks */ int Zflag; /* zero empty data blocks */ Modified: stable/11/sbin/fsck_ffs/main.c ============================================================================== --- stable/11/sbin/fsck_ffs/main.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/main.c Mon Oct 17 22:33:29 2016 (r307535) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <fstab.h> #include <grp.h> +#include <inttypes.h> #include <mntopts.h> #include <paths.h> #include <stdint.h> @@ -68,7 +69,7 @@ __FBSDID("$FreeBSD$"); int restarts; static void usage(void) __dead2; -static int argtoi(int flag, const char *req, const char *str, int base); +static intmax_t argtoimax(int flag, const char *req, const char *str, int base); static int checkfilesys(char *filesys); static int chkdoreload(struct statfs *mntp); static struct statfs *getmntpt(const char *); @@ -88,8 +89,8 @@ main(int argc, char *argv[]) switch (ch) { case 'b': skipclean = 0; - bflag = argtoi('b', "number", optarg, 10); - printf("Alternate super block location: %d\n", bflag); + bflag = argtoimax('b', "number", optarg, 10); + printf("Alternate super block location: %jd\n", bflag); break; case 'B': @@ -98,7 +99,8 @@ main(int argc, char *argv[]) case 'c': skipclean = 0; - cvtlevel = argtoi('c', "conversion level", optarg, 10); + cvtlevel = argtoimax('c', "conversion level", optarg, + 10); if (cvtlevel < 3) errx(EEXIT, "cannot do level %d conversion", cvtlevel); @@ -121,7 +123,7 @@ main(int argc, char *argv[]) break; case 'm': - lfmode = argtoi('m', "mode", optarg, 8); + lfmode = argtoimax('m', "mode", optarg, 8); if (lfmode &~ 07777) errx(EEXIT, "bad mode to -m: %o", lfmode); printf("** lost+found creation mode %o\n", lfmode); @@ -203,13 +205,13 @@ main(int argc, char *argv[]) exit(ret); } -static int -argtoi(int flag, const char *req, const char *str, int base) +static intmax_t +argtoimax(int flag, const char *req, const char *str, int base) { char *cp; - int ret; + intmax_t ret; - ret = (int)strtol(str, &cp, base); + ret = strtoimax(str, &cp, base); if (cp == str || *cp) errx(EEXIT, "-%c flag requires a %s", flag, req); return (ret); Modified: stable/11/sbin/fsck_ffs/setup.c ============================================================================== --- stable/11/sbin/fsck_ffs/setup.c Mon Oct 17 21:49:54 2016 (r307534) +++ stable/11/sbin/fsck_ffs/setup.c Mon Oct 17 22:33:29 2016 (r307535) @@ -196,7 +196,7 @@ setup(char *dev) bflag = 0; return(0); } - pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag); + pwarn("USING ALTERNATE SUPERBLOCK AT %jd\n", bflag); bflag = 0; } if (skipclean && ckclean && sblock.fs_clean) { @@ -329,7 +329,7 @@ readsb(int listerr) } if (sblock.fs_magic != FS_UFS1_MAGIC && sblock.fs_magic != FS_UFS2_MAGIC) { - fprintf(stderr, "%d is not a file system superblock\n", + fprintf(stderr, "%jd is not a file system superblock\n", bflag); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610172233.u9HMXTMW061029>