diff options
author | delphij <delphij@FreeBSD.org> | 2005-01-17 14:14:00 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2005-01-17 14:14:00 +0000 |
commit | 3d84f450ffb0ecedb8e9a1555da48645826dfae5 (patch) | |
tree | 031e9fa5d6bc8333281343ccc67744c0d72a7b8e /sbin | |
parent | f4455c7ee2148a5d723b03c9b95716908a37fa48 (diff) | |
download | FreeBSD-src-3d84f450ffb0ecedb8e9a1555da48645826dfae5.zip FreeBSD-src-3d84f450ffb0ecedb8e9a1555da48645826dfae5.tar.gz |
WARNS=6 cleanup:
- Initialize everything in the struct array, not only the mentioned
ones
- Unconditionally initialize hs to 0 to avoid repeatly doing so
- Cast to unsigned int when comparing to unsigned variables.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/newfs_msdos/Makefile | 3 | ||||
-rw-r--r-- | sbin/newfs_msdos/newfs_msdos.c | 32 |
2 files changed, 18 insertions, 17 deletions
diff --git a/sbin/newfs_msdos/Makefile b/sbin/newfs_msdos/Makefile index 1c52095..dd0fadd 100644 --- a/sbin/newfs_msdos/Makefile +++ b/sbin/newfs_msdos/Makefile @@ -3,6 +3,7 @@ PROG= newfs_msdos MAN= newfs_msdos.8 -WARNS?= 0 +WARNS?= 6 +CFLAGS+=${BDECFLAGS} .include <bsd.prog.mk> diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index fe9d56a..b645fb7 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -162,20 +162,22 @@ struct bpb { u_int bkbs; /* backup boot sector */ }; +#define BPBGAP 0, 0, 0, 0, 0, 0 + static struct { const char *name; struct bpb bpb; } stdfmt[] = { - {"160", {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1}}, - {"180", {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1}}, - {"320", {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2}}, - {"360", {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2}}, - {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2}}, - {"720", {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2}}, - {"1200", {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2}}, - {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2}}, - {"1440", {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2}}, - {"2880", {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2}} + {"160", {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1, BPBGAP}}, + {"180", {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, BPBGAP}}, + {"320", {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, BPBGAP}}, + {"360", {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, BPBGAP}}, + {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2, BPBGAP}}, + {"720", {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, BPBGAP}}, + {"1200", {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, BPBGAP}}, + {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2, BPBGAP}}, + {"1440", {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, BPBGAP}}, + {"2880", {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, BPBGAP}} }; static u_int8_t bootcode[] = { @@ -565,7 +567,7 @@ main(int argc, char *argv[]) if (opt_B && x < bss) { if ((n = read(fd1, img, bpb.bps)) == -1) err(1, "%s", bname); - if (n != bpb.bps) + if ((unsigned)n != bpb.bps) errx(1, "%s: can't read sector %u", bname, x); } else memset(img, 0, bpb.bps); @@ -653,7 +655,7 @@ main(int argc, char *argv[]) } if ((n = write(fd, img, bpb.bps)) == -1) err(1, "%s", fname); - if (n != bpb.bps) + if ((unsigned)n != bpb.bps) errx(1, "%s: can't write sector %u", fname, lsn); } } @@ -707,19 +709,18 @@ getstdfmt(const char *fmt, struct bpb *bpb) * Get disk slice, partition, and geometry information. */ static void -getdiskinfo(int fd, const char *fname, const char *dtype, int oflag, +getdiskinfo(int fd, const char *fname, const char *dtype, __unused int oflag, struct bpb *bpb) { struct disklabel *lp, dlp; struct fd_type type; - off_t ms, hs; + off_t ms, hs = 0; lp = NULL; /* If the user specified a disk type, try to use that */ if (dtype != NULL) { lp = getdiskbyname(dtype); - hs = 0; } /* Maybe it's a floppy drive */ @@ -732,7 +733,6 @@ getdiskinfo(int fd, const char *fname, const char *dtype, int oflag, dlp.d_ntracks = type.heads; dlp.d_secperunit = ms / dlp.d_secsize; lp = &dlp; - hs = 0; } } |