diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-07 18:26:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-07-07 18:26:23 +0000 |
commit | bca8ede36193523f5e509e218d1976dc9b8386e2 (patch) | |
tree | 8021052d902e951ea77cf9a839e25b3062a6b5bc /sbin | |
parent | f450dee1afdaa407e9eb35b9d02efd9642a245fa (diff) |
major -Wall cleanup, almost complete
Diffstat (limited to 'sbin')
45 files changed, 306 insertions, 254 deletions
diff --git a/sbin/atactl/atactl.c b/sbin/atactl/atactl.c index 57791cd6f7c..38c8cb27a41 100644 --- a/sbin/atactl/atactl.c +++ b/sbin/atactl/atactl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atactl.c,v 1.7 2001/06/04 14:59:47 mickey Exp $ */ +/* $OpenBSD: atactl.c,v 1.8 2001/07/07 18:26:09 deraadt Exp $ */ /* $NetBSD: atactl.c,v 1.4 1999/02/24 18:49:14 jwise Exp $ */ /*- @@ -540,7 +540,7 @@ device_smart(argc, argv) fprintf(stderr,"SMART threshold exceeded!\n"); exit(2); } else { - fprintf(stderr, "Unknown response %0.2x!\n", + fprintf(stderr, "Unknown response %02x!\n", req.cylinder); exit(1); } diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c index 2b7c55a0e5f..2fe03e08d70 100644 --- a/sbin/badsect/badsect.c +++ b/sbin/badsect/badsect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: badsect.c,v 1.4 1996/09/13 16:25:26 deraadt Exp $ */ +/* $OpenBSD: badsect.c,v 1.5 2001/07/07 18:26:10 deraadt Exp $ */ /* $NetBSD: badsect.c,v 1.10 1995/03/18 14:54:28 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)badsect.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: badsect.c,v 1.4 1996/09/13 16:25:26 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: badsect.c,v 1.5 2001/07/07 18:26:10 deraadt Exp $"; #endif #endif /* not lint */ @@ -217,13 +217,13 @@ rdfs(bno, size, bf) int n; if (lseek(fsi, (off_t)bno * dev_bsize, SEEK_SET) < 0) { - printf("seek error: %ld\n", bno); + printf("seek error: %lld\n", (long long)bno); perror("rdfs"); exit(1); } n = read(fsi, bf, size); if (n != size) { - printf("read error: %ld\n", bno); + printf("read error: %lld\n", (long long)bno); perror("rdfs"); exit(1); } diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c index 6db794497cb..b6cb1d79a71 100644 --- a/sbin/ccdconfig/ccdconfig.c +++ b/sbin/ccdconfig/ccdconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccdconfig.c,v 1.15 2001/06/04 14:59:47 mickey Exp $ */ +/* $OpenBSD: ccdconfig.c,v 1.16 2001/07/07 18:26:10 deraadt Exp $ */ /* $NetBSD: ccdconfig.c,v 1.6 1996/05/16 07:11:18 thorpej Exp $ */ /*- @@ -227,7 +227,7 @@ do_single(argc, argv, action) } /* Make sure there are enough arguments. */ - if (argc < 4) + if (argc < 4) { if (argc == 3) { /* Assume that no flags are specified. */ noflags = 1; @@ -238,6 +238,7 @@ do_single(argc, argv, action) } else usage(); } + } /* First argument is the ccd to configure. */ cp = *argv++; --argc; diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index f67ab2bdec9..b18605fe477 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.69 2000/06/30 16:00:08 millert Exp $ */ +/* $OpenBSD: disklabel.c,v 1.70 2001/07/07 18:26:10 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: disklabel.c,v 1.69 2000/06/30 16:00:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: disklabel.c,v 1.70 2001/07/07 18:26:10 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -332,6 +332,8 @@ main(argc, argv) break; } #endif + default: + break; } exit(error); } @@ -482,9 +484,9 @@ writelabel(f, boot, lp) } } if (verbose) - printf("writing label to block %qd (0x%qx)\n", - sectoffset/DEV_BSIZE, - sectoffset/DEV_BSIZE); + printf("writing label to block %lld (0x%qx)\n", + (long long)sectoffset/DEV_BSIZE, + (long long)sectoffset/DEV_BSIZE); if (!donothing) { if (lseek(f, sectoffset, SEEK_SET) < 0) { perror("lseek"); @@ -694,8 +696,8 @@ readlabel(f) DEV_BSIZE; #endif if (verbose) - printf("reading label from block %qd, offset %qd\n", - sectoffset/DEV_BSIZE, + printf("reading label from block %lld, offset %lld\n", + (long long)sectoffset/DEV_BSIZE, sectoffset/DEV_BSIZE + (LABELSECTOR * DEV_BSIZE) + LABELOFFSET); if (lseek(f, sectoffset, SEEK_SET) < 0 || @@ -725,8 +727,8 @@ readlabel(f) lp->d_magic2 == DISKMAGIC) { if (lp->d_npartitions <= MAXPARTITIONS && dkcksum(lp) == 0) { - warnx("found at 0x%x", (char *)lp - - bootarea); + warnx("found at 0x%lx", + (long)((char *)lp - bootarea)); return (lp); } msg = "disk label corrupted"; @@ -762,9 +764,9 @@ makebootarea(boot, dp, f) { struct disklabel *lp; char *p; - int b; #if NUMBOOT > 0 char *dkbasename; + int b; #if NUMBOOT == 1 struct stat sb; #endif @@ -896,10 +898,10 @@ makedisktab(f, lp) struct partition *pp; if (lp->d_packname[0]) - (void)fprintf(f, "%.*s|", sizeof(lp->d_packname), + (void)fprintf(f, "%.*s|", (int)sizeof(lp->d_packname), lp->d_packname); if (lp->d_typename[0]) - (void)fprintf(f, "%.*s|", sizeof(lp->d_typename), + (void)fprintf(f, "%.*s|", (int)sizeof(lp->d_typename), lp->d_typename); (void)fputs("Automatically generated label:\\\n\t:dt=", f); if ((unsigned) lp->d_type < DKMAXTYPES) @@ -939,7 +941,7 @@ makedisktab(f, lp) } for (i = 0; i < NDDATA; i++) if (lp->d_drivedata[i]) - (void)fprintf(f, "d%d#%d", lp->d_drivedata[i]); + (void)fprintf(f, "d%d#%d", i, lp->d_drivedata[i]); pp = lp->d_partitions; for (i = 0; i < lp->d_npartitions; i++, pp++) { if (pp->p_size) { @@ -1034,6 +1036,7 @@ display_partition(f, lp, mp, i, unit, width) default: p_size = -1; /* no conversion */ + p_offset = 0; break; } @@ -1763,7 +1766,7 @@ usage() blank); fprintf(stderr, " disklabel [-nv] [-r|-cd] [-f temp] -E disk%.*s (simple editor)\n", - strlen(blank) - 5, blank); + (int)strlen(blank) - 5, blank); fprintf(stderr, " disklabel [-nv] [-r]%s -R disk proto (restore)\n", boot); diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index bda80f1b775..41bb294d2c9 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.76 2001/05/19 05:10:46 millert Exp $ */ +/* $OpenBSD: editor.c,v 1.77 2001/07/07 18:26:10 deraadt Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -28,7 +28,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: editor.c,v 1.76 2001/05/19 05:10:46 millert Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.77 2001/07/07 18:26:10 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -148,7 +148,7 @@ editor(lp, f, dev, fstabfile) u_int32_t freesectors; FILE *fp; char buf[BUFSIZ], *cmd, *arg; - char **mountpoints = NULL, **omountpoints, **tmpmountpoints; + char **mountpoints = NULL, **omountpoints = NULL, **tmpmountpoints = NULL; /* Alloc and init mount point info */ if (fstabfile) { @@ -1692,8 +1692,9 @@ find_bounds(lp, bios_lp) struct disklabel *lp; struct disklabel *bios_lp; { +#ifdef DOSLABEL struct partition *pp = &lp->d_partitions[RAW_PART]; - +#endif /* Defaults */ /* XXX - reserve a cylinder for hp300? */ starting_sector = 0; @@ -2364,8 +2365,9 @@ get_geometry(f, dgpp, bgpp) #endif struct stat st; struct disklabel *disk_geop; +#ifdef CPU_BIOS struct disklabel *bios_geop; - +#endif if (fstat(f, &st) == -1) err(4, "Can't stat device"); diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index a59dc231e42..bc3700576bf 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dmesg.c,v 1.12 2001/07/07 00:11:26 millert Exp $ */ +/* $OpenBSD: dmesg.c,v 1.13 2001/07/07 18:26:11 deraadt Exp $ */ /* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dmesg.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: dmesg.c,v 1.12 2001/07/07 00:11:26 millert Exp $"; +static char rcsid[] = "$OpenBSD: dmesg.c,v 1.13 2001/07/07 18:26:11 deraadt Exp $"; #endif #endif /* not lint */ @@ -81,7 +81,7 @@ main(argc, argv) char *argv[]; { register int ch, newl, skip, i; - register char *p, *ep; + register char *p; struct msgbuf cur; char *memf, *nlistf, *bufdata; char buf[5]; diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c index bd2505a31a4..61fbe4e4ad0 100644 --- a/sbin/fsck/fsck.c +++ b/sbin/fsck/fsck.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsck.c,v 1.6 1997/02/28 00:47:44 millert Exp $ */ +/* $OpenBSD: fsck.c,v 1.7 2001/07/07 18:26:11 deraadt Exp $ */ /* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */ /* @@ -282,18 +282,20 @@ checkfs(vfstype, spec, mntpt, auxarg, pidp) (void)snprintf(execname, sizeof(execname), "%s/fsck_%s", *edir, vfstype); execv(execname, (char * const *)argv); - if (errno != ENOENT) + if (errno != ENOENT) { if (spec) warn("exec %s for %s", execname, spec); else warn("exec %s", execname); + } } while (*++edir != NULL); - if (errno == ENOENT) + if (errno == ENOENT) { if (spec) warn("exec %s for %s", execname, spec); else warn("exec %s", execname); + } exit(1); /* NOTREACHED */ @@ -455,7 +457,7 @@ mangle(opts, argcp, argvp, maxargcp) maxargc += 50; argv = erealloc(argv, maxargc * sizeof(char *)); } - if (*p != '\0') + if (*p != '\0') { if (*p == '-') { argv[argc++] = p; p = strchr(p, '='); @@ -468,6 +470,7 @@ mangle(opts, argcp, argvp, maxargcp) argv[argc++] = "-o"; argv[argc++] = p; } + } } *argcp = argc; diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c index 934a004be5f..c9cf7f1397d 100644 --- a/sbin/fsck_ext2fs/dir.c +++ b/sbin/fsck_ext2fs/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.4 2000/04/26 23:26:05 jasoni Exp $ */ +/* $OpenBSD: dir.c,v 1.5 2001/07/07 18:26:11 deraadt Exp $ */ /* $NetBSD: dir.c,v 1.1 1997/06/11 11:21:46 bouyer Exp $ */ /* @@ -42,7 +42,7 @@ static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94"; #if 0 static char rcsid[] = "$NetBSD: dir.c,v 1.1 1997/06/11 11:21:46 bouyer Exp $"; #else -static char rcsid[] = "$OpenBSD: dir.c,v 1.4 2000/04/26 23:26:05 jasoni Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.5 2001/07/07 18:26:11 deraadt Exp $"; #endif #endif #endif /* not lint */ @@ -551,7 +551,7 @@ expanddir(dp, name) { daddr_t lastbn, newblk; register struct bufarea *bp; - char *cp, *firstblk; + char *firstblk; if ((firstblk = malloc(sblock.e2fs_bsize)) == NULL) { fprintf(stderr, "out of memory"); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index ba303c99ebb..73908135c03 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.c,v 1.16 2001/05/15 19:32:39 mickey Exp $ */ +/* $OpenBSD: inode.c,v 1.17 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95"; #else -static char rcsid[] = "$OpenBSD: inode.c,v 1.16 2001/05/15 19:32:39 mickey Exp $"; +static char rcsid[] = "$OpenBSD: inode.c,v 1.17 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -528,7 +528,7 @@ pinode(ino) printf("MODE=%o\n", dp->di_mode); if (preen) printf("%s: ", cdevname()); - printf("SIZE=%qu ", dp->di_size); + printf("SIZE=%llu ", (unsigned long long)dp->di_size); t = dp->di_mtime; p = ctime(&t); printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]); diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 3b8eae09457..8eb9287b78b 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass1.c,v 1.8 2001/03/02 08:33:55 art Exp $ */ +/* $OpenBSD: pass1.c,v 1.9 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: pass1.c,v 1.16 1996/09/27 22:45:15 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: pass1.c,v 1.8 2001/03/02 08:33:55 art Exp $"; +static char rcsid[] = "$OpenBSD: pass1.c,v 1.9 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -148,7 +148,7 @@ checkinode(inumber, idesc) if (/* dp->di_size < 0 || */ dp->di_size + sblock.fs_bsize - 1 < dp->di_size) { if (debug) - printf("bad size %qu:", dp->di_size); + printf("bad size %llu:", (unsigned long long)dp->di_size); goto unknown; } if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) { @@ -160,8 +160,8 @@ checkinode(inumber, idesc) ndb = howmany(dp->di_size, sblock.fs_bsize); if (ndb < 0) { if (debug) - printf("bad size %qu ndb %d:", - dp->di_size, ndb); + printf("bad size %llu ndb %d:", + (unsigned long long)dp->di_size, ndb); goto unknown; } if (mode == IFBLK || mode == IFCHR) @@ -184,8 +184,9 @@ checkinode(inumber, idesc) errexit("cannot read symlink"); if (debug) { symbuf[dp->di_size] = 0; - printf("convert symlink %d(%s) of size %qd\n", - inumber, symbuf, dp->di_size); + printf("convert symlink %d(%s) of size %llu\n", + inumber, symbuf, + (unsigned long long)dp->di_size); } dp = ginode(inumber); memcpy(dp->di_shortlink, symbuf, (long)dp->di_size); diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index 0280ebcf6e7..0d09da1c17b 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass2.c,v 1.9 2001/05/28 21:22:47 gluk Exp $ */ +/* $OpenBSD: pass2.c,v 1.10 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94"; #else -static char rcsid[] = "$OpenBSD: pass2.c,v 1.9 2001/05/28 21:22:47 gluk Exp $"; +static char rcsid[] = "$OpenBSD: pass2.c,v 1.10 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -178,12 +178,12 @@ pass2() } else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) { getpathname(pathbuf, inp->i_number, inp->i_number); if (usedsoftdep) - pfatal("%s %s: LENGTH %d NOT MULTIPLE of %d", - "DIRECTORY", pathbuf, inp->i_isize, + pfatal("%s %s: LENGTH %ld NOT MULTIPLE of %d", + "DIRECTORY", pathbuf, (long)inp->i_isize, DIRBLKSIZ); else - pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d", - "DIRECTORY", pathbuf, inp->i_isize, + pwarn("%s %s: LENGTH %ld NOT MULTIPLE OF %d", + "DIRECTORY", pathbuf, (long)inp->i_isize, DIRBLKSIZ); if (preen) printf(" (ADJUSTED)\n"); diff --git a/sbin/fsck_ffs/pass3.c b/sbin/fsck_ffs/pass3.c index eb4ecbd728e..0caa1d1fe7d 100644 --- a/sbin/fsck_ffs/pass3.c +++ b/sbin/fsck_ffs/pass3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass3.c,v 1.4 2001/05/28 21:22:47 gluk Exp $ */ +/* $OpenBSD: pass3.c,v 1.5 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: pass3.c,v 1.8 1995/03/18 14:55:54 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pass3.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: pass3.c,v 1.4 2001/05/28 21:22:47 gluk Exp $"; +static char rcsid[] = "$OpenBSD: pass3.c,v 1.5 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -57,7 +57,7 @@ pass3_info(buf, buflen) char *buf; int buflen; { - return snprintf(buf, buflen, "phase 3, directory %d/%d", + return snprintf(buf, buflen, "phase 3, directory %d/%ld", info_pos, inplast); } diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index f0025528732..cc3508038f6 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass5.c,v 1.11 2001/03/09 07:26:09 mickey Exp $ */ +/* $OpenBSD: pass5.c,v 1.12 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: pass5.c,v 1.16 1996/09/27 22:45:18 christos Exp $ */ /* @@ -38,14 +38,18 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -static char rcsid[] = "$OpenBSD: pass5.c,v 1.11 2001/03/09 07:26:09 mickey Exp $"; +static char rcsid[] = "$OpenBSD: pass5.c,v 1.12 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ #include <sys/param.h> #include <sys/time.h> +#include <sys/lock.h> #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> +#include <ufs/ufs/quota.h> +#include <ufs/ufs/inode.h> +#include <ufs/ffs/ffs_extern.h> #include <stdio.h> #include <string.h> @@ -343,7 +347,7 @@ pass5() continue; if (cg_inosused(cg)[i] & (1 << k)) continue; - pwarn("ALLOCATED INODE %d MARKED FREE\n", + pwarn("ALLOCATED INODE %ld MARKED FREE\n", c * fs->fs_ipg + i * 8 + k); } } @@ -356,7 +360,7 @@ pass5() continue; if (cg_inosused(cg)[i] & (1 << k)) continue; - pwarn("ALLOCATED FRAG %d MARKED FREE\n", + pwarn("ALLOCATED FRAG %ld MARKED FREE\n", c * fs->fs_fpg + i * 8 + k); } } diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 0f8217f4cba..13249699b47 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.12 2001/05/15 09:01:02 deraadt Exp $ */ +/* $OpenBSD: setup.c,v 1.13 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94"; #else -static char rcsid[] = "$OpenBSD: setup.c,v 1.12 2001/05/15 09:01:02 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: setup.c,v 1.13 2001/07/07 18:26:12 deraadt Exp $"; #endif #endif /* not lint */ @@ -233,8 +233,8 @@ setup(dev) } if (sblock.fs_inodefmt >= FS_44INODEFMT) { if (sblock.fs_maxfilesize != maxfilesize) { - pwarn("INCORRECT MAXFILESIZE=%qd IN SUPERBLOCK", - sblock.fs_maxfilesize); + pwarn("INCORRECT MAXFILESIZE=%llu IN SUPERBLOCK", + (unsigned long long)sblock.fs_maxfilesize); sblock.fs_maxfilesize = maxfilesize; if (preen) printf(" (FIXED)\n"); @@ -255,8 +255,8 @@ setup(dev) } } if (sblock.fs_qbmask != ~sblock.fs_bmask) { - pwarn("INCORRECT QBMASK=%qx IN SUPERBLOCK", - sblock.fs_qbmask); + pwarn("INCORRECT QBMASK=%lx IN SUPERBLOCK", + (unsigned long)sblock.fs_qbmask); sblock.fs_qbmask = ~sblock.fs_bmask; if (preen) printf(" (FIXED)\n"); @@ -266,8 +266,8 @@ setup(dev) } } if (sblock.fs_qfmask != ~sblock.fs_fmask) { - pwarn("INCORRECT QFMASK=%qx IN SUPERBLOCK", - sblock.fs_qfmask); + pwarn("INCORRECT QFMASK=%lx IN SUPERBLOCK", + (unsigned long)sblock.fs_qfmask); sblock.fs_qfmask = ~sblock.fs_fmask; if (preen) printf(" (FIXED)\n"); @@ -372,8 +372,8 @@ setup(dev) } lncntp = (int16_t *)calloc((unsigned)(maxino + 1), sizeof(int16_t)); if (lncntp == NULL) { - printf("cannot alloc %u bytes for lncntp\n", - (unsigned)(maxino + 1) * sizeof(int16_t)); + printf("cannot alloc %lu bytes for lncntp\n", + (unsigned long)(maxino + 1) * sizeof(int16_t)); goto badsblabel; } numdirs = sblock.fs_cstotal.cs_ndir; @@ -384,8 +384,8 @@ setup(dev) inphead = (struct inoinfo **)calloc((unsigned)numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { - printf("cannot alloc %u bytes for inphead\n", - (unsigned)numdirs * sizeof(struct inoinfo *)); + printf("cannot alloc %lu bytes for inphead\n", + (unsigned long)numdirs * sizeof(struct inoinfo *)); goto badsblabel; } bufinit(); @@ -497,7 +497,7 @@ readsb(listerr) if (*olp == *nlp) continue; printf("offset %d, original %ld, alternate %ld\n", - olp - (long *)&sblock, *olp, *nlp); + (int)(olp - (long *)&sblock), *olp, *nlp); } } badsb(listerr, diff --git a/sbin/fsck_msdos/check.c b/sbin/fsck_msdos/check.c index 823fbc9d129..20bd39d21b3 100644 --- a/sbin/fsck_msdos/check.c +++ b/sbin/fsck_msdos/check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check.c,v 1.7 1999/03/25 01:45:01 aaron Exp $ */ +/* $OpenBSD: check.c,v 1.8 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: check.c,v 1.7 1999/03/25 01:45:01 aaron Exp $"; +static char rcsid[] = "$OpenBSD: check.c,v 1.8 2001/07/07 18:26:12 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -82,11 +82,12 @@ checkfilesys(fname) return (8); } - if (!preen) + if (!preen) { if (boot.ValidFat < 0) printf("** Phase 1 - Read and Compare FATs\n"); else printf("** Phase 1 - Read FAT\n"); + } mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat); if (mod & FSFATAL) { diff --git a/sbin/fsck_msdos/dir.c b/sbin/fsck_msdos/dir.c index a5a197d88fb..607f8001bd4 100644 --- a/sbin/fsck_msdos/dir.c +++ b/sbin/fsck_msdos/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.12 2001/07/03 13:03:45 ian Exp $ */ +/* $OpenBSD: dir.c,v 1.13 2001/07/07 18:26:12 deraadt Exp $ */ /* $NetBSD: dir.c,v 1.11 1997/10/17 11:19:35 ws Exp $ */ /* @@ -37,7 +37,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: dir.c,v 1.12 2001/07/03 13:03:45 ian Exp $"; +static char rcsid[] = "$OpenBSD: dir.c,v 1.13 2001/07/07 18:26:12 deraadt Exp $"; #endif /* not lint */ #include <stdio.h> @@ -804,7 +804,7 @@ readDosDirSection(f, boot, fat, dir) continue; } if (strcmp(dirent.name, "..") == 0) { - if (dir->parent) /* XXX */ + if (dir->parent) { /* XXX */ if (!dir->parent->parent) { if (dirent.head) { pwarn("`..' entry in %s has non-zero start cluster\n", @@ -833,6 +833,7 @@ readDosDirSection(f, boot, fat, dir) } else mod |= FSERROR; } + } continue; } diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c index 4dd13cea046..f31b9b2695f 100644 --- a/sbin/fsdb/fsdbutil.c +++ b/sbin/fsdb/fsdbutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fsdbutil.c,v 1.5 1997/01/16 04:04:21 millert Exp $ */ +/* $OpenBSD: fsdbutil.c,v 1.6 2001/07/07 18:26:13 deraadt Exp $ */ /* $NetBSD: fsdbutil.c,v 1.5 1996/09/28 19:30:37 christos Exp $ */ /*- @@ -38,7 +38,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: fsdbutil.c,v 1.5 1997/01/16 04:04:21 millert Exp $"; +static char rcsid[] = "$OpenBSD: fsdbutil.c,v 1.6 2001/07/07 18:26:13 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -140,7 +140,7 @@ printstat(cp, inum, dp) puts("fifo"); break; } - printf("I=%u MODE=%o SIZE=%qu", inum, dp->di_mode, dp->di_size); + printf("I=%u MODE=%o SIZE=%llu", inum, dp->di_mode, dp->di_size); t = dp->di_mtime; p = ctime(&t); printf("\n\tMTIME=%15.15s %4.4s [%d nsec]", &p[4], &p[20], diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 8f32ec19a8f..020d84192af 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.48 2001/05/07 13:53:26 markus Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.49 2001/07/07 18:26:13 deraadt Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -81,7 +81,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #else -static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.48 2001/05/07 13:53:26 markus Exp $"; +static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.49 2001/07/07 18:26:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -195,6 +195,7 @@ void unsetvlandev __P((char *, int)); void vlan_status (); void fixnsel __P((struct sockaddr_iso *)); int main __P((int, char *[])); +int prefix __P((void *val, int)); /* * Media stuff. Whenever a media command is first performed, the @@ -371,7 +372,7 @@ main(argc, argv) int argc; char *argv[]; { - register const struct afswtch *rafp; + register const struct afswtch *rafp = NULL; int aflag = 0; int ifaliases = 0; int i; diff --git a/sbin/kbd/kbd_wscons.c b/sbin/kbd/kbd_wscons.c index 84f6760d89f..68b3d99b41f 100644 --- a/sbin/kbd/kbd_wscons.c +++ b/sbin/kbd/kbd_wscons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kbd_wscons.c,v 1.3 2001/06/04 20:05:06 maja Exp $ */ +/* $OpenBSD: kbd_wscons.c,v 1.4 2001/07/07 18:26:14 deraadt Exp $ */ /* * Copyright (c) 2001 Mats O Jansson. All rights reserved. @@ -29,6 +29,11 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/ioctl.h> +#include <sys/time.h> +#include <dev/wscons/wsconsio.h> +#include <dev/wscons/wsksymdef.h> + #include <err.h> #include <errno.h> #include <kvm.h> @@ -36,10 +41,7 @@ #include <limits.h> #include <nlist.h> #include <stdio.h> -#include <sys/ioctl.h> -#include <sys/time.h> -#include <dev/wscons/wsconsio.h> -#include <dev/wscons/wsksymdef.h> +#include <unistd.h> #define NUM_KBD 10 @@ -92,7 +94,7 @@ kbd_show_enc(kd, idx) unsigned long p; struct nameint *n; int found; - long variant; + u_int32_t variant; printf("tables available for %s keyboard:\nencoding\n\n", kbtype_tab[idx]); diff --git a/sbin/mknod/mknod.c b/sbin/mknod/mknod.c index 88b0428fcd4..58a1da1127f 100644 --- a/sbin/mknod/mknod.c +++ b/sbin/mknod/mknod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknod.c,v 1.8 2000/02/28 17:03:26 millert Exp $ */ +/* $OpenBSD: mknod.c,v 1.9 2001/07/07 18:26:14 deraadt Exp $ */ /* $NetBSD: mknod.c,v 1.8 1995/08/11 00:08:18 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mknod.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: mknod.c,v 1.8 2000/02/28 17:03:26 millert Exp $"; +static char rcsid[] = "$OpenBSD: mknod.c,v 1.9 2001/07/07 18:26:14 deraadt Exp $"; #endif #endif /* not lint */ @@ -73,7 +73,7 @@ main(argc, argv) { int ch, ismkfifo = 0; void *set = NULL; - mode_t mode; + mode_t mode = 0; setlocale (LC_ALL, ""); @@ -93,7 +93,7 @@ main(argc, argv) * interpreted relative to an assumed initial mode of * a=rw. */ - mode = getmode (set, DEFFILEMODE); + mode = getmode(set, DEFFILEMODE); free(set); break; case '?': diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index fa0c69b601d..711023e26d5 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modload.c,v 1.24 2001/03/22 23:17:50 deraadt Exp $ */ +/* $OpenBSD: modload.c,v 1.25 2001/07/07 18:26:15 deraadt Exp $ */ /* $NetBSD: modload.c,v 1.13 1995/05/28 05:21:58 jtc Exp $ */ /* @@ -255,7 +255,7 @@ main(argc, argv) p = modobj; snprintf(modout, sizeof modout, "%s%s.XXXXXXXX.o", _PATH_TMP, p); - if (modfd = mkstemps(modout, strlen(".o")) == -1) + if ((modfd = mkstemps(modout, strlen(".o"))) == -1) err(1, "creating %s", modout); close(modfd); out = modout; diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 857ab5e2720..3387acdf96a 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_nfs.c,v 1.21 2001/07/07 00:19:52 millert Exp $ */ +/* $OpenBSD: mount_nfs.c,v 1.22 2001/07/07 18:26:15 deraadt Exp $ */ /* $NetBSD: mount_nfs.c,v 1.12.4.1 1996/05/25 22:48:05 fvdl Exp $ */ /* @@ -210,7 +210,6 @@ main(argc, argv) struct nfsd_cargs ncd; int mntflags, altflags, i, nfssvc_flag, num; char *name, *p, *spec; - int error = 0; #ifdef NFSKERB uid_t last_ruid; #endif @@ -429,7 +428,7 @@ main(argc, argv) } if (nfsargsp->flags & NFSMNT_KERB) { if ((opflags & ISBGRND) == 0) { - if (i = fork()) { + if ((i = fork())) { if (i == -1) err(1, "Couldn't launch NFS kerberos service process"); exit(0); @@ -693,7 +692,7 @@ tryagain: if (--retrycnt > 0) { if (opflags & BGRND) { opflags &= ~BGRND; - if (i = fork()) { + if ((i = fork())) { if (i == -1) err(1, "nqnfs 2"); exit(0); diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c index 7a3596e395c..3ce9159f02a 100644 --- a/sbin/ncheck_ffs/ncheck_ffs.c +++ b/sbin/ncheck_ffs/ncheck_ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncheck_ffs.c,v 1.5 1997/01/15 23:41:30 millert Exp $ */ +/* $OpenBSD: ncheck_ffs.c,v 1.6 2001/07/07 18:26:16 deraadt Exp $ */ /*- * Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> @@ -31,7 +31,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.5 1997/01/15 23:41:30 millert Exp $"; +static char rcsid[] = "$OpenBSD: ncheck_ffs.c,v 1.6 2001/07/07 18:26:16 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -258,12 +258,12 @@ loop: if ((cnt = read(diskfd, buf, (int)dev_bsize)) == dev_bsize) continue; if (cnt == -1) { - warnx("read error from %s: %s: [sector %d]: count=%d\n", - disk, strerror(errno), blkno, dev_bsize); + warnx("read error from %s: %s: [sector %d]: count=%ld\n", + disk, strerror(errno), blkno, dev_bsize); continue; } - warnx("short read error from %s: [sector %d]: count=%d, got=%d\n", - disk, blkno, dev_bsize, cnt); + warnx("short read error from %s: [sector %d]: count=%ld, got=%d\n", + disk, blkno, dev_bsize, cnt); } } @@ -370,7 +370,7 @@ searchdir(ino, blkno, size, filesize, path) for (loc = 0; loc < size;) { dp = (struct direct *)(dblk + loc); if (dp->d_reclen == 0) { - warnx("corrupted directory, inode %lu", ino); + warnx("corrupted directory, inode %lu", (long)ino); break; } loc += dp->d_reclen; @@ -385,8 +385,11 @@ searchdir(ino, blkno, size, filesize, path) mode = di->di_mode & IFMT; if (bsearch(&dp->d_ino, ilist, ninodes, sizeof(*ilist), matchino)) { if (mflag) - printf("mode %-6o uid %-5lu gid %-5lu ino ", di->di_mode, di->di_uid, di->di_gid); - printf("%-7lu %s/%s%s\n", dp->d_ino, path, dp->d_name, mode == IFDIR ? "/." : ""); + printf("mode %-6o uid %-5lu gid %-5lu ino ", + di->di_mode, (unsigned long)di->di_uid, + (unsigned long)di->di_gid); + printf("%-7lu %s/%s%s\n", (unsigned long)dp->d_ino, + path, dp->d_name, mode == IFDIR ? "/." : ""); } if (mode == IFDIR) { if (dp->d_name[0] == '.') { @@ -486,7 +489,7 @@ main(argc, argv) dev_bsize = sblock->fs_fsize / fsbtodb(sblock, 1); dev_bshift = ffs(dev_bsize) - 1; if (dev_bsize != (1 << dev_bshift)) - errx(2, "blocksize (%d) not a power of 2", dev_bsize); + errx(2, "blocksize (%ld) not a power of 2", dev_bsize); findinodes(sblock->fs_ipg * sblock->fs_ncg); printf("%s:\n", disk); scanonedir(ROOTINO, ""); diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 947382b6e5d..318495ab7cf 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.18 2001/04/19 16:22:17 gluk Exp $ */ +/* $OpenBSD: mkfs.c,v 1.19 2001/07/07 18:26:16 deraadt Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94"; #else -static char rcsid[] = "$OpenBSD: mkfs.c,v 1.18 2001/04/19 16:22:17 gluk Exp $"; +static char rcsid[] = "$OpenBSD: mkfs.c,v 1.19 2001/07/07 18:26:16 deraadt Exp $"; #endif #endif /* not lint */ @@ -53,6 +53,8 @@ static char rcsid[] = "$OpenBSD: mkfs.c,v 1.18 2001/04/19 16:22:17 gluk Exp $"; #include <sys/ioctl.h> #include <string.h> +#include <stdlib.h> +#include <signal.h> #include <unistd.h> #ifndef STANDALONE @@ -110,8 +112,6 @@ extern int avgfilesperdir; /* expected number of files per directory */ extern int quiet; /* quiet flag */ extern u_long memleft; /* virtual memory available */ extern caddr_t membase; /* start address of memory based filesystem */ -static caddr_t malloc(), calloc(); -static void free(); union fs_u { struct fs fs; @@ -131,9 +131,20 @@ struct dinode *zino; char *buf; int fsi, fso; -daddr_t alloc(); -static int charsperline(); +daddr_t alloc(int, int); +static int charsperline(); +void initcg(int, time_t); +void wtfs(daddr_t, int, void *); +void fsinit(time_t); +int makedir(struct direct *, int); +void iput(struct dinode *, ino_t); +void setblock(struct fs *, unsigned char *, int); +void clrblock(struct fs *, unsigned char *, int); +int isblock(struct fs *, unsigned char *, int); +void rdfs(daddr_t, int, void *); + +void mkfs(pp, fsys, fi, fo) struct partition *pp; char *fsys; @@ -144,7 +155,8 @@ mkfs(pp, fsys, fi, fo) long used, mincpgcnt, bpcg; long mapcramped, inodecramped; long postblsize, rotblsize, totalsbsize; - int ppid, status; + pid_t ppid = -1; + int status; time_t utime; quad_t sizepb; void started(); @@ -165,7 +177,7 @@ mkfs(pp, fsys, fi, fo) if (mfs) { ppid = getpid(); (void) signal(SIGUSR1, started); - if (i = fork()) { + if ((i = fork())) { if (i == -1) { perror("mfs"); exit(10); @@ -359,7 +371,8 @@ recalc: if (mincpc == 1 || sblock.fs_frag == 1 || sblock.fs_bsize == MINBSIZE) break; - printf("With a block size of %d %s %d\n", sblock.fs_bsize, + printf("With a block size of %ld %s %ld\n", + (long)sblock.fs_bsize, "minimum bytes per inode is", (mincpg * bpcg - used) / MAXIPG(&sblock) + 1); sblock.fs_bsize >>= 1; @@ -378,16 +391,16 @@ recalc: } if (inodecramped) { if (inospercg > MAXIPG(&sblock)) { - printf("Minimum bytes per inode is %d\n", + printf("Minimum bytes per inode is %ld\n", (mincpg * bpcg - used) / MAXIPG(&sblock) + 1); } else if (!mapcramped) { printf("With %d bytes per inode, ", density); - printf("minimum cylinders per group is %d\n", mincpg); + printf("minimum cylinders per group is %ld\n", mincpg); } } if (mapcramped) { printf("With %d sectors per cylinder, ", sblock.fs_spc); - printf("minimum cylinders per group is %d\n", mincpg); + printf("minimum cylinders per group is %ld\n", mincpg); } if (inodecramped || mapcramped) { if (sblock.fs_bsize != bsize) @@ -405,7 +418,7 @@ recalc: */ sblock.fs_cpg = cpg; if (sblock.fs_cpg % mincpc != 0) { - printf("%s groups must have a multiple of %d cylinders\n", + printf("%s groups must have a multiple of %ld cylinders\n", cpgflg ? "Cylinder" : "Warning: cylinder", mincpc); sblock.fs_cpg = roundup(sblock.fs_cpg, mincpc); if (!cpgflg) @@ -438,11 +451,11 @@ recalc: } sblock.fs_fpg = (sblock.fs_cpg * sblock.fs_spc) / NSPF(&sblock); if ((sblock.fs_cpg * sblock.fs_spc) % NSPB(&sblock) != 0) { - printf("panic (fs_cpg * fs_spc) % NSPF != 0"); + printf("panic (fs_cpg * fs_spc) %% NSPF != 0"); exit(24); } if (sblock.fs_cpg < mincpg) { - printf("cylinder groups must have at least %d cylinders\n", + printf("cylinder groups must have at least %ld cylinders\n", mincpg); exit(25); } else if (sblock.fs_cpg != cpg) { @@ -550,7 +563,7 @@ next: sblock.fs_dblkno = sblock.fs_iblkno + sblock.fs_ipg / INOPF(&sblock); i = MIN(~sblock.fs_cgmask, sblock.fs_ncg - 1); if (cgdmin(&sblock, i) - cgbase(&sblock, i) >= sblock.fs_fpg) { - printf("inode blocks/cyl group (%d) >= data blocks (%d)\n", + printf("inode blocks/cyl group (%ld) >= data blocks (%d)\n", cgdmin(&sblock, i) - cgbase(&sblock, i) / sblock.fs_frag, sblock.fs_fpg / sblock.fs_frag); printf("number of cylinders per cylinder group (%d) %s.\n", @@ -566,10 +579,10 @@ next: (cgdmin(&sblock, 0) + 3 * sblock.fs_frag)); exit(30); } - printf("Warning: inode blocks/cyl group (%d) >= data blocks (%d) in last\n", + printf("Warning: inode blocks/cyl group (%ld) >= data blocks (%ld) in last\n", (cgdmin(&sblock, j) - cgbase(&sblock, j)) / sblock.fs_frag, i / sblock.fs_frag); - printf(" cylinder group. This implies %d sector(s) cannot be allocated.\n", + printf(" cylinder group. This implies %ld sector(s) cannot be allocated.\n", i * NSPF(&sblock)); sblock.fs_ncg--; sblock.fs_ncyl -= sblock.fs_ncyl % sblock.fs_cpg; @@ -649,8 +662,8 @@ next: initcg(cylno, utime); if (quiet) continue; - j = sprintf(tmpbuf, " %d,", - fsbtodb(&sblock, cgsblock(&sblock, cylno))); + j = sprintf(tmpbuf, " %ld,", + fsbtodb(&sblock, cgsblock(&sblock, cylno))); if (i+j >= width) { printf("\n"); i = 0; @@ -706,12 +719,13 @@ next: /* * Initialize a cylinder group. */ +void initcg(cylno, utime) int cylno; time_t utime; { daddr_t cbase, d, dlower, dupper, dmax, blkno; - long i, j, s; + long i, j; register struct csum *cs; /* @@ -795,7 +809,7 @@ initcg(cylno, utime) sblock.fs_dsize += dlower; } sblock.fs_dsize += acg.cg_ndblk - dupper; - if (i = dupper % sblock.fs_frag) { + if ((i = dupper % sblock.fs_frag)) { acg.cg_frsum[sblock.fs_frag - i]++; for (d = dupper + sblock.fs_frag - i; dupper < d; dupper++) { setbit(cg_blksfree(&acg), dupper); @@ -855,7 +869,7 @@ initcg(cylno, utime) sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree; *cs = acg.cg_cs; wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), - sblock.fs_bsize, (char *)&acg); + sblock.fs_bsize, (char *)&acg); } /* @@ -901,11 +915,10 @@ struct odirect olost_found_dir[] = { }; #endif +void fsinit(utime) time_t utime; { - int i; - /* * initialize the node */ @@ -917,11 +930,15 @@ fsinit(utime) * create the lost+found directory */ if (Oflag) { + int i; + (void)makedir((struct direct *)olost_found_dir, 2); for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) memcpy(&buf[i], &olost_found_dir[2], DIRSIZ(0, &olost_found_dir[2])); } else { + int i; + (void)makedir(lost_found_dir, 2); for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) memcpy(&buf[i], &lost_found_dir[2], @@ -957,8 +974,9 @@ fsinit(utime) * construct a set of directory entries in "buf". * return size of directory. */ +int makedir(protodir, entries) - register struct direct *protodir; + struct direct *protodir; int entries; { char *cp; @@ -1034,6 +1052,7 @@ goth: /* * Allocate an inode on the disk */ +void iput(ip, ino) register struct dinode *ip; register ino_t ino; @@ -1083,11 +1102,11 @@ started() /* * Replace libc function with one suited to our needs. */ -static caddr_t +static void * malloc(size) - register u_long size; + size_t size; { - char *base, *i; + void *base, *i; static u_long pgsz; struct rlimit rlp; @@ -1109,16 +1128,16 @@ malloc(size) memleft -= size; if (size == 0) return (0); - return ((caddr_t)sbrk(size)); + return (sbrk(size)); } /* * Replace libc function with one suited to our needs. */ -static caddr_t +static void * realloc(ptr, size) - char *ptr; - u_long size; + void *ptr; + size_t size; { void *p; @@ -1134,11 +1153,12 @@ realloc(ptr, size) /* * Replace libc function with one suited to our needs. */ -static char * +static void * calloc(size, numelm) - u_long size, numelm; + size_t size; + size_t numelm; { - caddr_t base; + void *base; size *= numelm; if ((base = malloc(size)) != 0) @@ -1151,7 +1171,7 @@ calloc(size, numelm) */ static void free(ptr) - char *ptr; + void *ptr; { /* do not worry about it for now */ @@ -1160,10 +1180,11 @@ free(ptr) /* * read a block from the file system */ +void rdfs(bno, size, bf) daddr_t bno; int size; - char *bf; + void *bf; { int n; off_t offset; @@ -1175,13 +1196,13 @@ rdfs(bno, size, bf) offset = bno; offset *= sectorsize; if (lseek(fsi, offset, SEEK_SET) < 0) { - printf("seek error: %ld\n", bno); + printf("seek error: %lld\n", (long long)bno); perror("rdfs"); exit(33); } n = read(fsi, bf, size); if (n != size) { - printf("read error: %ld\n", bno); + printf("read error: %lld\n", (long long)bno); perror("rdfs"); exit(34); } @@ -1190,10 +1211,11 @@ rdfs(bno, size, bf) /* * write a block to the file system */ +void wtfs(bno, size, bf) daddr_t bno; int size; - char *bf; + void *bf; { int n; off_t offset; @@ -1207,13 +1229,13 @@ wtfs(bno, size, bf) offset = bno; offset *= sectorsize; if (lseek(fso, offset, SEEK_SET) < 0) { - printf("seek error: %ld\n", bno); + printf("seek error: %lld\n", (long long)bno); perror("wtfs"); exit(35); } n = write(fso, bf, size); if (n != size) { - printf("write error: %ld\n", bno); + printf("write error: %lld\n", (long long)bno); perror("wtfs"); exit(36); } @@ -1222,6 +1244,7 @@ wtfs(bno, size, bf) /* * check if a block is available */ +int isblock(fs, cp, h) struct fs *fs; unsigned char *cp; @@ -1254,6 +1277,7 @@ isblock(fs, cp, h) /* * take a block out of the map */ +void clrblock(fs, cp, h) struct fs *fs; unsigned char *cp; @@ -1285,6 +1309,7 @@ clrblock(fs, cp, h) /* * put a block into the map */ +void setblock(fs, cp, h) struct fs *fs; unsigned char *cp; diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 301173b9335..d60cea5f77e 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.27 2001/04/19 16:22:18 gluk Exp $ */ +/* $OpenBSD: newfs.c,v 1.28 2001/07/07 18:26:16 deraadt Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: newfs.c,v 1.27 2001/04/19 16:22:18 gluk Exp $"; +static char rcsid[] = "$OpenBSD: newfs.c,v 1.28 2001/07/07 18:26:16 deraadt Exp $"; #endif #endif /* not lint */ @@ -71,6 +71,7 @@ static char rcsid[] = "$OpenBSD: newfs.c,v 1.27 2001/04/19 16:22:18 gluk Exp $"; #include <syslog.h> #include <unistd.h> #include <util.h> +#include <err.h> #ifdef __STDC__ #include <stdarg.h> @@ -88,11 +89,11 @@ struct mntopt mopts[] = { { NULL }, }; -#ifdef __STDC__ -void fatal(const char *fmt, ...); -#else -void fatal(); -#endif +void fatal __P((const char *fmt, ...)); +void usage __P((void)); +void mkfs __P((struct partition *, char *, int, int)); +void rewritelabel __P((char *, int, struct disklabel *)); +u_short dkcksum __P((struct disklabel *)); #define COMPAT /* allow non-labeled disks */ @@ -205,7 +206,7 @@ main(argc, argv) struct partition oldpartition; struct stat st; struct statfs *mp; - int fsi, fso, len, n, maxpartitions; + int fsi = -1, fso, len, n, maxpartitions; char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ]; char *fstype = NULL; char **saveargv = argv; @@ -400,7 +401,7 @@ main(argc, argv) goto havelabel; } cp = strrchr(special, '/'); - if (cp == 0) { + if (cp == NULL) { /* * No path prefix; try /dev/r%s then /dev/%s. */ @@ -458,8 +459,8 @@ main(argc, argv) printf("%s: %s: not a character-special device\n", __progname, special); cp = strchr(argv[0], '\0') - 1; - if (cp == 0 || (*cp < 'a' || *cp > ('a' + maxpartitions - 1)) - && !isdigit(*cp)) + if (cp == 0 || ((*cp < 'a' || *cp > ('a' + maxpartitions - 1)) + && !isdigit(*cp))) fatal("%s: can't figure out file system partition", argv[0]); lp = getdisklabel(special, fsi); @@ -549,8 +550,9 @@ havelabel: secpercyl = nsectors * ntracks - cylspares; if (secpercyl != lp->d_secpercyl) fprintf(stderr, "%s (%d) %s (%lu)\n", - "Warning: calculated sectors per cylinder", secpercyl, - "disagrees with disk label", lp->d_secpercyl); + "Warning: calculated sectors per cylinder", secpercyl, + "disagrees with disk label", + (unsigned long)lp->d_secpercyl); if (maxbpg == 0) maxbpg = MAXBLKPG(bsize); #ifdef notdef /* label may be 0 if faked up by kernel */ @@ -639,6 +641,7 @@ getdisklabel(s, fd) return (&lab); } +void rewritelabel(s, fd, lp) char *s; int fd; @@ -756,6 +759,7 @@ struct fsoptions { { NULL, NULL } }; +void usage() { struct fsoptions *fsopt; diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index e6d86e48853..e2c8f4066bd 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -737,11 +737,12 @@ getdiskinfo(int fd, const char *fname, const char *dtype, int oflag, #ifdef __FreeBSD__ struct diskslices ds; int slice = -1; + char *s; + int fd1, e; #endif struct disklabel dl, *lp; const char *s1, *s2; - char *s; - int part, fd1, i, e; + int part, i; part = -1; s1 = fname; @@ -929,7 +930,7 @@ argtou(const char *arg, u_int lo, u_int hi, const char *msg) static int oklabel(const char *src) { - int c, i; + int c = 0, i; for (i = 0; i <= 11; i++) { c = (u_char)*src++; diff --git a/sbin/nfsd/nfsd.c b/sbin/nfsd/nfsd.c index 6deadf87ccf..6126cf78fa5 100644 --- a/sbin/nfsd/nfsd.c +++ b/sbin/nfsd/nfsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsd.c,v 1.13 2001/06/04 14:59:48 mickey Exp $ */ +/* $OpenBSD: nfsd.c,v 1.14 2001/07/07 18:26:17 deraadt Exp $ */ /* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */ /* @@ -139,26 +139,29 @@ main(argc, argv, envp) int argc; char *argv[], *envp[]; { - struct group *grp; struct nfsd_args nfsdargs; - struct passwd *pwd; - struct ucred *cr; struct sockaddr_in inetaddr, inetpeer; #ifdef ISO struct sockaddr_iso isoaddr, isopeer; #endif - struct timeval ktv; fd_set ready, sockbits; - int ch, cltpflag, connect_type_cnt, i, len, maxsock, msgsock; + int ch, cltpflag, connect_type_cnt, i, len, maxsock = 0, msgsock; int nfsdcnt, nfssvc_flag, on, reregister, sock, tcpflag, tcpsock; - int tp4cnt, tp4flag, tp4sock, tpipcnt, tpipflag, tpipsock, udpflag; + int tp4cnt, tpipcnt, udpflag; +#ifdef NFSKERB + struct ucred *cr; char *cp, **cpp; + int tpipflag = 0, tp4flag = 0, tpipsock = 0, tp4sock; + struct timeval ktv; + struct passwd *pwd; + struct group *grp; +#endif #define MAXNFSDCNT 20 #define DEFNFSDCNT 4 nfsdcnt = DEFNFSDCNT; - cltpflag = reregister = tcpflag = tp4cnt = tp4flag = tpipcnt = 0; - tpipflag = udpflag = 0; + cltpflag = reregister = tcpflag = tp4cnt = tpipcnt = 0; + tcpsock = udpflag = 0; #ifdef ISO #define GETOPT "cn:rtu" #define USAGE "[-crtu] [-n num_servers]" diff --git a/sbin/photurisd/config.h b/sbin/photurisd/config.h index e356439481f..88e957998b4 100644 --- a/sbin/photurisd/config.h +++ b/sbin/photurisd/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.4 2001/01/28 22:45:07 niklas Exp $ */ +/* $OpenBSD: config.h,v 1.5 2001/07/07 18:26:17 deraadt Exp $ */ /* * Copyright 1997-2000 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -73,10 +73,6 @@ #ifdef _CONFIG_C_ #define EXTERN -#ifndef DEBUG -void reconfig(int sig); -#endif - #else #define EXTERN extern #endif @@ -119,5 +115,7 @@ EXTERN int pick_scheme(u_int8_t **, u_int16_t *, u_int8_t *, u_int16_t); EXTERN int pick_attrib(struct stateob *, u_int8_t **, u_int16_t *); EXTERN int select_attrib(struct stateob *, u_int8_t **, u_int16_t *); +EXTERN void reconfig(int sig); + #endif /* _CONFIG_H_ */ diff --git a/sbin/photurisd/kernel.c b/sbin/photurisd/kernel.c index b3c2784a300..32b424b164c 100644 --- a/sbin/photurisd/kernel.c +++ b/sbin/photurisd/kernel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernel.c,v 1.23 2001/06/27 03:31:46 angelos Exp $ */ +/* $OpenBSD: kernel.c,v 1.24 2001/07/07 18:26:18 deraadt Exp $ */ /* * Copyright 1997-2000 Niels Provos <provos@citi.umich.edu> @@ -41,7 +41,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: kernel.c,v 1.23 2001/06/27 03:31:46 angelos Exp $"; +static char rcsid[] = "$OpenBSD: kernel.c,v 1.24 2001/07/07 18:26:18 deraadt Exp $"; #endif #include <time.h> @@ -1409,7 +1409,7 @@ kernel_request_sa(struct sadb_msg *sadb) struct stateob *st; time_t tm; struct sadb_address *dst, *src; - struct sockaddr *dstaddr, *srcaddr; + struct sockaddr *dstaddr; struct sadb_ext *ext = (struct sadb_ext *)(sadb + 1); char srcbuf[NI_MAXHOST], dstbuf[NI_MAXHOST]; void *end; diff --git a/sbin/photurisd/modulus.c b/sbin/photurisd/modulus.c index dc4832d96f2..682bca9b53c 100644 --- a/sbin/photurisd/modulus.c +++ b/sbin/photurisd/modulus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modulus.c,v 1.5 2001/01/28 22:45:12 niklas Exp $ */ +/* $OpenBSD: modulus.c,v 1.6 2001/07/07 18:26:18 deraadt Exp $ */ /* * Copyright 1997-2000 Niels Provos <provos@citi.umich.edu> @@ -81,7 +81,7 @@ mod_unlink(struct moduli_cache *ob) void mod_check_prime(int iter, int tm) { - struct moduli_cache *p, *tmp, *next; + struct moduli_cache *p, *tmp = NULL, *next; time_t now; int flag; BN_CTX *ctx; diff --git a/sbin/photurisd/photurisd.c b/sbin/photurisd/photurisd.c index acb145f4538..e343f28448c 100644 --- a/sbin/photurisd/photurisd.c +++ b/sbin/photurisd/photurisd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: photurisd.c,v 1.11 2001/03/08 21:41:47 deraadt Exp $ */ +/* $OpenBSD: photurisd.c,v 1.12 2001/07/07 18:26:18 deraadt Exp $ */ /* * Copyright 1997-2000 Niels Provos <provos@citi.umich.edu> @@ -34,7 +34,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: photurisd.c,v 1.11 2001/03/08 21:41:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: photurisd.c,v 1.12 2001/07/07 18:26:18 deraadt Exp $"; #endif #define _PHOTURIS_C_ @@ -117,8 +117,10 @@ main(int argc, char **argv) { int ch; int primes = 0, ignore = 0; - int cls, level; char *dir = PHOTURIS_DIR; +#ifdef USE_DEBUG + int cls, level = 0; +#endif daemon_mode = 0; global_port = 0; diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index bf8db96729c..1c0284ae223 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ping6.c,v 1.31 2001/06/27 03:31:48 angelos Exp $ */ +/* $OpenBSD: ping6.c,v 1.32 2001/07/07 18:26:18 deraadt Exp $ */ /* $KAME: ping6.c,v 1.129 2001/06/22 13:16:02 itojun Exp $ */ /* @@ -1309,7 +1309,7 @@ dnsdecode(sp, ep, base, buf, bufsiz) u_char *buf; size_t bufsiz; { - int i; + int i = 0; const u_char *cp; char cresult[MAXDNAME + 1]; const u_char *comp; @@ -1939,7 +1939,7 @@ pr_nodeaddr(ni, nilen) if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) withttl = 1; while (nilen > 0) { - u_int32_t ttl; + u_int32_t ttl = 0; if (withttl) { /* XXX: alignment? */ diff --git a/sbin/raidctl/raidctl.c b/sbin/raidctl/raidctl.c index 4e34089259c..a17ad79a84d 100644 --- a/sbin/raidctl/raidctl.c +++ b/sbin/raidctl/raidctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raidctl.c,v 1.6 2001/06/04 14:59:49 mickey Exp $ */ +/* $OpenBSD: raidctl.c,v 1.7 2001/07/07 18:26:19 deraadt Exp $ */ /* $NetBSD: raidctl.c,v 1.11 2000/01/09 03:06:35 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -109,7 +109,7 @@ main(argc,argv) int is_clean; int raidID; int rawpart; - int serial_number; + int serial_number = 0; struct stat st; int fd; int force; @@ -744,7 +744,7 @@ do_meter( fd, option ) double elapsed; int elapsed_sec; int elapsed_usec; - int simple_eta,last_eta; + int simple_eta; double rate; int amount; int tbit_value; @@ -801,11 +801,6 @@ do_meter( fd, option ) } else { simple_eta = -1; } - if (simple_eta <=0) { - simple_eta = last_eta; - } else { - last_eta = simple_eta; - } get_time_string(eta_buffer, simple_eta); diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index f4e4b59994f..a3a86d993f4 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interactive.c,v 1.11 2001/01/19 17:57:41 deraadt Exp $ */ +/* $OpenBSD: interactive.c,v 1.12 2001/07/07 18:26:19 deraadt Exp $ */ /* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)interactive.c 8.3 (Berkeley) 9/13/94"; #else -static char rcsid[] = "$OpenBSD: interactive.c,v 1.11 2001/01/19 17:57:41 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: interactive.c,v 1.12 2001/07/07 18:26:19 deraadt Exp $"; #endif #endif /* not lint */ @@ -517,7 +517,7 @@ printlist(name, basename) char *name; char *basename; { - register struct afile *fp, *list, *listp; + register struct afile *fp, *list, *listp = NULL; register struct direct *dp; struct afile single; RST_DIR *dirp; @@ -666,7 +666,7 @@ formatf(list, nentry) { register struct afile *fp, *endlist; int width, bigino, haveprefix, havepostfix; - int i, j, w, precision, columns, lines; + int i, j, w, precision = 0, columns, lines; width = 0; haveprefix = 0; diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 471125e441b..b77930aedc1 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tape.c,v 1.17 2001/01/09 03:26:06 angelos Exp $ */ +/* $OpenBSD: tape.c,v 1.18 2001/07/07 18:26:20 deraadt Exp $ */ /* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */ /* @@ -155,7 +155,7 @@ void newtapebuf(size) long size; { - static tapebufsize = -1; + static long tapebufsize = -1; ntrec = size; if (size <= tapebufsize) @@ -272,7 +272,7 @@ void getvol(nextvol) long nextvol; { - long newvol, savecnt, wantnext, i; + long newvol = 0, savecnt, wantnext, i; union u_spcl tmpspcl; # define tmpbuf tmpspcl.s_spcl char buf[TP_BSIZE]; @@ -651,7 +651,7 @@ getfile(fill, skip) static char clearedbuf[MAXBSIZE]; char buf[MAXBSIZE / TP_BSIZE][TP_BSIZE]; char junk[TP_BSIZE]; - int noskip = (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI); + volatile int noskip = (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI); if (spcl.c_type == TS_END) panic("ran off end of tape\n"); diff --git a/sbin/route/route.c b/sbin/route/route.c index cccdd1774c8..76a7bfbdbf4 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.42 2001/05/11 17:51:56 mickey Exp $ */ +/* $OpenBSD: route.c,v 1.43 2001/07/07 18:26:20 deraadt Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: route.c,v 1.42 2001/05/11 17:51:56 mickey Exp $"; +static char rcsid[] = "$OpenBSD: route.c,v 1.43 2001/07/07 18:26:20 deraadt Exp $"; #endif #endif /* not lint */ @@ -234,7 +234,7 @@ flushroutes(argc, argv) { size_t needed; int mib[6], rlen, seqno; - char *buf = NULL, *next, *lim; + char *buf = NULL, *next, *lim = NULL; struct rt_msghdr *rtm; struct sockaddr *sa; @@ -933,7 +933,7 @@ getaddr(which, s, hpp) char *s; struct hostent **hpp; { - sup su; + sup su = NULL; struct ns_addr ns_addr(); struct ipx_addr ipx_addr(); struct iso_addr *iso_addr(); diff --git a/sbin/route/show.c b/sbin/route/show.c index b6b0b2e470a..ee4efc6c331 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.19 2000/11/15 01:45:48 angelos Exp $ */ +/* $OpenBSD: show.c,v 1.20 2001/07/07 18:26:20 deraadt Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94"; #else -static char *rcsid = "$OpenBSD: show.c,v 1.19 2000/11/15 01:45:48 angelos Exp $"; +static char *rcsid = "$OpenBSD: show.c,v 1.20 2001/07/07 18:26:20 deraadt Exp $"; #endif #endif /* not lint */ @@ -108,6 +108,9 @@ static void p_flags __P((int, char *)); static void pr_rthdr __P((void)); static void pr_family __P((int)); +int keyword(char *); +void usage(char *); + /* * Print routing tables. */ @@ -117,7 +120,7 @@ show(argc, argv) char **argv; { struct rt_msghdr *rtm; - char *buf = NULL, *next, *lim; + char *buf = NULL, *next, *lim = NULL; size_t needed; int mib[6], af = 0; struct sockaddr *sa; diff --git a/sbin/routed/main.c b/sbin/routed/main.c index 3b590f05da8..2ff8bb2cc55 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.11 2001/06/13 20:13:29 markus Exp $ */ +/* $OpenBSD: main.c,v 1.12 2001/07/07 18:26:20 deraadt Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -39,7 +39,7 @@ char copyright[] = #if !defined(lint) static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.11 2001/06/13 20:13:29 markus Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.12 2001/07/07 18:26:20 deraadt Exp $"; #endif #include "defs.h" @@ -47,9 +47,10 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.11 2001/06/13 20:13:29 markus Exp $" #ifdef sgi #include "math.h" #endif -#include <signal.h> -#include <fcntl.h> #include <sys/file.h> +#include <fcntl.h> +#include <err.h> +#include <signal.h> pid_t mypid; diff --git a/sbin/routed/output.c b/sbin/routed/output.c index a19872cb17c..06abe9370e2 100644 --- a/sbin/routed/output.c +++ b/sbin/routed/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.6 2001/01/05 05:23:46 angelos Exp $ */ +/* $OpenBSD: output.c,v 1.7 2001/07/07 18:26:20 deraadt Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -36,7 +36,7 @@ #if !defined(lint) static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: output.c,v 1.6 2001/01/05 05:23:46 angelos Exp $"; +static char rcsid[] = "$OpenBSD: output.c,v 1.7 2001/07/07 18:26:20 deraadt Exp $"; #endif #include "defs.h" @@ -96,7 +96,7 @@ output(enum output_type type, { struct sockaddr_in sin; int flags; - char *msg; + char *msg = NULL; int res; naddr tgt_mcast; int soc; diff --git a/sbin/routed/table.c b/sbin/routed/table.c index 7354e264191..d19310b51d5 100644 --- a/sbin/routed/table.c +++ b/sbin/routed/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.5 1997/07/30 23:28:45 deraadt Exp $ */ +/* $OpenBSD: table.c,v 1.6 2001/07/07 18:26:20 deraadt Exp $ */ /* * Copyright (c) 1983, 1988, 1993 @@ -1674,7 +1674,7 @@ rtswitch(struct rt_entry *rt, return; swap = rt->rt_spares[0]; - (void)sprintf(label, "Use #%d", rts - rt->rt_spares); + (void)sprintf(label, "Use #%d", (int)(rts - rt->rt_spares)); rtchange(rt, rt->rt_state & ~(RS_NET_SYN | RS_RDISC), rts->rts_gate, rts->rts_router, rts->rts_metric, rts->rts_tag, rts->rts_ifp, rts->rts_time, label); diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index cd7abc3ab9c..cda28767e2d 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: savecore.c,v 1.25 2001/06/20 23:12:48 niklas Exp $ */ +/* $OpenBSD: savecore.c,v 1.26 2001/07/07 18:26:21 deraadt Exp $ */ /* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)savecore.c 8.3 (Berkeley) 1/2/94"; #else -static char rcsid[] = "$OpenBSD: savecore.c,v 1.25 2001/06/20 23:12:48 niklas Exp $"; +static char rcsid[] = "$OpenBSD: savecore.c,v 1.26 2001/07/07 18:26:21 deraadt Exp $"; #endif #endif /* not lint */ @@ -250,17 +250,17 @@ kmem_setup() exit(1); } - KREAD(kd_kern, current_nl[X_DUMPDEV].n_value, &dumpdev); + (void)KREAD(kd_kern, current_nl[X_DUMPDEV].n_value, &dumpdev); if (dumpdev == NODEV) { syslog(LOG_WARNING, "no core dump (no dumpdev)"); exit(1); } - KREAD(kd_kern, current_nl[X_DUMPLO].n_value, &dumplo); + (void)KREAD(kd_kern, current_nl[X_DUMPLO].n_value, &dumplo); dumplo *= DEV_BSIZE; if (verbose) - (void)printf("dumplo = %d (%d * %d)\n", + (void)printf("dumplo = %ld (%ld * %d)\n", dumplo, dumplo / DEV_BSIZE, DEV_BSIZE); - KREAD(kd_kern, current_nl[X_DUMPMAG].n_value, &dumpmag); + (void) KREAD(kd_kern, current_nl[X_DUMPMAG].n_value, &dumpmag); if (kernel == NULL) { if (kvm_read(kd_kern, current_nl[X_VERSION].n_value, @@ -332,7 +332,7 @@ check_kmem() _PATH_UNIX, vers, core_vers); } - KREAD(kd_dump, dump_nl[X_PANICSTR].n_value, &panicstr); + (void)KREAD(kd_dump, dump_nl[X_PANICSTR].n_value, &panicstr); if (panicstr) { char c, visout[5]; size_t vislen; @@ -359,10 +359,10 @@ dump_exists() { int newdumpmag; - KREAD(kd_dump, dump_nl[X_DUMPMAG].n_value, &newdumpmag); + (void)KREAD(kd_dump, dump_nl[X_DUMPMAG].n_value, &newdumpmag); /* Read the dump size. */ - KREAD(kd_dump, dump_nl[X_DUMPSIZE].n_value, &dumpsize); + (void)KREAD(kd_dump, dump_nl[X_DUMPSIZE].n_value, &dumpsize); dumpsize *= getpagesize(); /* @@ -395,7 +395,7 @@ void save_core() { register FILE *fp; - register int bounds, ifd, nr, nw, ofd; + register int bounds, ifd, nr, nw, ofd = -1; char *rawp, path[MAXPATHLEN]; mode_t um; @@ -572,7 +572,7 @@ rawname(s) "can't make raw dump device name from %s", s); return (s); } - (void)snprintf(name, sizeof(name), "%.*s/r%s", sl - s, s, sl + 1); + (void)snprintf(name, sizeof(name), "%.*s/r%s", (int)(sl - s), s, sl + 1); if ((sl = strdup(name)) == NULL) { syslog(LOG_ERR, "%s", strerror(errno)); exit(1); @@ -585,7 +585,7 @@ get_crashtime() { time_t dumptime; /* Time the dump was taken. */ - KREAD(kd_dump, dump_nl[X_TIME].n_value, &dumptime); + (void)KREAD(kd_dump, dump_nl[X_TIME].n_value, &dumptime); if (dumptime == 0) { if (verbose) syslog(LOG_ERR, "dump time is zero"); diff --git a/sbin/scan_ffs/scan_ffs.c b/sbin/scan_ffs/scan_ffs.c index c292dd669b0..b74cdde88b9 100644 --- a/sbin/scan_ffs/scan_ffs.c +++ b/sbin/scan_ffs/scan_ffs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scan_ffs.c,v 1.6 2001/01/26 17:36:41 weingart Exp $ */ +/* $OpenBSD: scan_ffs.c,v 1.7 2001/07/07 18:26:21 deraadt Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner @@ -87,9 +87,9 @@ ufsscan(fd, beg, end, flags) sb->fs_fsize, sb->fs_bsize, sb->fs_cpg, lastmount); } else { - printf("ffs at %d size %qd mount %s time %s", + printf("ffs at %d size %lld mount %s time %s", blk+(n/512)-(2*SBSIZE/512), - (off_t)sb->fs_size * sb->fs_fsize, + (long long)(off_t)sb->fs_size * sb->fs_fsize, lastmount, ctime(&sb->fs_time)); } diff --git a/sbin/scsi/scsi.c b/sbin/scsi/scsi.c index 1e22cd9408b..96b693faf3f 100644 --- a/sbin/scsi/scsi.c +++ b/sbin/scsi/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.7 2001/03/08 21:41:50 deraadt Exp $ */ +/* $OpenBSD: scsi.c,v 1.8 2001/07/07 18:26:21 deraadt Exp $ */ /* $FreeBSD: scsi.c,v 1.11 1996/04/06 11:00:28 joerg Exp $ */ /* @@ -402,7 +402,7 @@ do_cmd(int fd, char *fmt, int argc, char **argv) exit(errno); } else if (amount == 0) - fprintf(stderr, "Warning: wrote only %d bytes out of %d.\n", + fprintf(stderr, "Warning: wrote only %u bytes out of %u.\n", scsireq->datalen - count, scsireq->datalen); @@ -711,7 +711,6 @@ edit_report(void *hook, int letter, void *arg, int count, char *name) static int edit_get(void *hook, char *name) { - struct get_hook *h = (struct get_hook *)hook; int arg = editinfo[editind].default_value; if (editinfo[editind].can_edit) { @@ -975,7 +974,6 @@ main(int argc, char **argv) exit(1); } } else if (commandflag) { - int i; char *fmt; if (argc < 1) { diff --git a/sbin/shutdown/shutdown.c b/sbin/shutdown/shutdown.c index 4e5697a5a47..52ed7cb6f86 100644 --- a/sbin/shutdown/shutdown.c +++ b/sbin/shutdown/shutdown.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shutdown.c,v 1.20 2001/01/19 17:57:43 deraadt Exp $ */ +/* $OpenBSD: shutdown.c,v 1.21 2001/07/07 18:26:22 deraadt Exp $ */ /* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)shutdown.c 8.2 (Berkeley) 2/16/94"; #else -static char rcsid[] = "$OpenBSD: shutdown.c,v 1.20 2001/01/19 17:57:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: shutdown.c,v 1.21 2001/07/07 18:26:22 deraadt Exp $"; #endif #endif /* not lint */ @@ -461,15 +461,16 @@ getoffset(timearg) } /* handle hh:mm by getting rid of the colon */ - for (p = timearg; *p; ++p) - if (!isascii(*p) || !isdigit(*p)) + for (p = timearg; *p; ++p) { + if (!isascii(*p) || !isdigit(*p)) { if (*p == ':' && strlen(p) == 3) { p[0] = p[1]; p[1] = p[2]; p[2] = '\0'; - } - else + } else badtime(); + } + } unsetenv("TZ"); /* OUR timezone */ lt = localtime(&now); /* current time val */ diff --git a/sbin/wsconsctl/wsconsctl.c b/sbin/wsconsctl/wsconsctl.c index 3bac2da488c..aca5e43fa31 100644 --- a/sbin/wsconsctl/wsconsctl.c +++ b/sbin/wsconsctl/wsconsctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsctl.c,v 1.5 2001/06/30 02:12:57 mickey Exp $ */ +/* $OpenBSD: wsconsctl.c,v 1.6 2001/07/07 18:26:22 deraadt Exp $ */ /* $NetBSD: wsconsctl.c,v 1.2 1998/12/29 22:40:20 hannken Exp $ */ /*- @@ -94,7 +94,7 @@ main(argc, argv) int argc; char **argv; { - int i, ch, fd, error; + int i, ch, fd = -1, error; int aflag, wflag; char *sep, *p; const struct vartypesw *sw; |