errexit() now provides the trailing \n (since fsck_ffs assumed that

from a conversion from err(3)), so "make it so".
This commit is contained in:
lukem 2008-03-16 23:17:55 +00:00
parent 0b1dda7d78
commit 481ad7b03a
12 changed files with 61 additions and 57 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsutil.c,v 1.17 2008/02/23 21:41:47 christos Exp $ */
/* $NetBSD: fsutil.c,v 1.18 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1990, 1993
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fsutil.c,v 1.17 2008/02/23 21:41:47 christos Exp $");
__RCSID("$NetBSD: fsutil.c,v 1.18 2008/03/16 23:17:55 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -87,6 +87,7 @@ errexit(const char *fmt, ...)
va_start(ap, fmt);
(void) vfprintf(stderr, fmt, ap);
va_end(ap);
(void)fprintf(stderr, "\n");
exit(FSCK_EXIT_CHECK_FAILED);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.21 2008/03/16 22:32:14 lukem Exp $ */
/* $NetBSD: dir.c,v 1.22 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94";
#else
__RCSID("$NetBSD: dir.c,v 1.21 2008/03/16 22:32:14 lukem Exp $");
__RCSID("$NetBSD: dir.c,v 1.22 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -165,7 +165,7 @@ dirscan(struct inodesc *idesc)
err(8, "Can't allocate directory block");
if (idesc->id_type != DATA)
errexit("wrong type to dirscan %d\n", idesc->id_type);
errexit("wrong type to dirscan %d", idesc->id_type);
if (idesc->id_entryno == 0 &&
(idesc->id_filesize & (sblock.e2fs_bsize - 1)) != 0)
idesc->id_filesize = roundup(idesc->id_filesize, sblock.e2fs_bsize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.21 2007/11/16 16:55:04 tsutsui Exp $ */
/* $NetBSD: inode.c,v 1.22 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
#else
__RCSID("$NetBSD: inode.c,v 1.21 2007/11/16 16:55:04 tsutsui Exp $");
__RCSID("$NetBSD: inode.c,v 1.22 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -377,7 +377,7 @@ ginode(ino_t inumber)
!(inumber == EXT2_RESIZEINO &&
(sblock.e2fs.e2fs_features_compat & EXT2F_COMPAT_RESIZE) != 0))
|| inumber > maxino)
errexit("bad inode number %llu to ginode\n",
errexit("bad inode number %llu to ginode",
(unsigned long long)inumber);
if (startinum == 0 ||
inumber < startinum || inumber >= startinum + sblock.e2fs_ipb) {
@ -406,7 +406,7 @@ getnextinode(ino_t inumber)
static struct ext2fs_dinode *dp;
if (inumber != nextino++ || inumber > maxino)
errexit("bad inode number %llu to nextinode\n",
errexit("bad inode number %llu to nextinode",
(unsigned long long)inumber);
if (inumber >= lastinum) {
readcnt++;
@ -446,7 +446,7 @@ resetinodebuf(void)
if (inodebuf == NULL &&
(inodebuf = (struct ext2fs_dinode *)malloc((unsigned)inobufsize)) ==
NULL)
errexit("Cannot allocate space for inode buffer\n");
errexit("Cannot allocate space for inode buffer");
while (nextino < EXT2_ROOTINO)
(void)getnextinode(nextino);
}
@ -501,7 +501,7 @@ cacheino(struct ext2fs_dinode *dp, ino_t inumber)
inpsort = (struct inoinfo **)realloc((char *)inpsort,
(unsigned)listmax * sizeof(struct inoinfo *));
if (inpsort == NULL)
errexit("cannot increase directory list\n");
errexit("cannot increase directory list");
}
inpsort[inplast++] = inp;
}
@ -519,7 +519,7 @@ getinoinfo(ino_t inumber)
continue;
return (inp);
}
errexit("cannot find inode %llu\n", (unsigned long long)inumber);
errexit("cannot find inode %llu", (unsigned long long)inumber);
return ((struct inoinfo *)0);
}
@ -654,7 +654,7 @@ blkerror(ino_t ino, const char *type, daddr_t blk)
return;
default:
errexit("BAD STATE %d TO BLKERR\n", statemap[ino]);
errexit("BAD STATE %d TO BLKERR", statemap[ino]);
/* NOTREACHED */
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.27 2008/02/23 21:41:48 christos Exp $ */
/* $NetBSD: main.c,v 1.28 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
__RCSID("$NetBSD: main.c,v 1.27 2008/02/23 21:41:48 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.28 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -126,7 +126,7 @@ main(int argc, char *argv[])
case 'm':
lfmode = argtoi('m', "mode", optarg, 8);
if (lfmode &~ 07777)
errexit("bad mode to -m: %o\n", lfmode);
errexit("bad mode to -m: %o", lfmode);
printf("** lost+found creation mode %o\n", lfmode);
break;
@ -184,7 +184,7 @@ argtoi(int flag, const char *req, const char *str, int base)
ret = (int)strtol(str, &cp, base);
if (cp == str || *cp)
errexit("-%c flag requires a %s\n", flag, req);
errexit("-%c flag requires a %s", flag, req);
return (ret);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass1.c,v 1.16 2007/11/16 16:55:04 tsutsui Exp $ */
/* $NetBSD: pass1.c,v 1.17 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93";
#else
__RCSID("$NetBSD: pass1.c,v 1.16 2007/11/16 16:55:04 tsutsui Exp $");
__RCSID("$NetBSD: pass1.c,v 1.17 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -83,6 +83,7 @@ __RCSID("$NetBSD: pass1.c,v 1.16 2007/11/16 16:55:04 tsutsui Exp $");
#include "fsck.h"
#include "extern.h"
#include "fsutil.h"
#include "exitvalues.h"
static daddr_t badblk;
static daddr_t dupblk;
@ -285,7 +286,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
if (zlnp == NULL) {
pfatal("LINK COUNT TABLE OVERFLOW");
if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
} else {
zlnp->zlncnt = inumber;
zlnp->next = zlnhead;
@ -347,7 +348,7 @@ pass1check(struct inodesc *idesc)
if (preen)
printf(" (SKIPPING)\n");
else if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
return (STOP);
}
}
@ -365,14 +366,14 @@ pass1check(struct inodesc *idesc)
if (preen)
printf(" (SKIPPING)\n");
else if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
return (STOP);
}
new = (struct dups *)malloc(sizeof(struct dups));
if (new == NULL) {
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
return (STOP);
}
new->dup = blkno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass2.c,v 1.13 2005/06/26 23:01:39 christos Exp $ */
/* $NetBSD: pass2.c,v 1.14 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94";
#else
__RCSID("$NetBSD: pass2.c,v 1.13 2005/06/26 23:01:39 christos Exp $");
__RCSID("$NetBSD: pass2.c,v 1.14 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -82,6 +82,7 @@ __RCSID("$NetBSD: pass2.c,v 1.13 2005/06/26 23:01:39 christos Exp $");
#include "fsck.h"
#include "fsutil.h"
#include "extern.h"
#include "exitvalues.h"
#define MINDIRSIZE (sizeof (struct ext2fs_dirtemplate))
@ -103,9 +104,9 @@ pass2(void)
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
if (allocdir(EXT2_ROOTINO, EXT2_ROOTINO, 0755) != EXT2_ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
errexit("CANNOT ALLOCATE ROOT INODE");
break;
case DCLEAR:
@ -113,11 +114,11 @@ pass2(void)
if (reply("REALLOCATE")) {
freeino(EXT2_ROOTINO);
if (allocdir(EXT2_ROOTINO, EXT2_ROOTINO, 0755) != EXT2_ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
errexit("CANNOT ALLOCATE ROOT INODE");
break;
}
if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
break;
case FSTATE:
@ -126,11 +127,11 @@ pass2(void)
if (reply("REALLOCATE")) {
freeino(EXT2_ROOTINO);
if (allocdir(EXT2_ROOTINO, EXT2_ROOTINO, 0755) != EXT2_ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
errexit("CANNOT ALLOCATE ROOT INODE");
break;
}
if (reply("FIX") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
dp = ginode(EXT2_ROOTINO);
dp->e2di_mode = h2fs16((fs2h16(dp->e2di_mode) & ~IFMT) | IFDIR);
inodirty();
@ -140,7 +141,7 @@ pass2(void)
break;
default:
errexit("BAD STATE %d FOR ROOT INODE\n", statemap[EXT2_ROOTINO]);
errexit("BAD STATE %d FOR ROOT INODE", statemap[EXT2_ROOTINO]);
}
/*
@ -453,7 +454,7 @@ again:
break;
default:
errexit("BAD STATE %d FOR INODE I=%d\n",
errexit("BAD STATE %d FOR INODE I=%d",
statemap[fs2h32(dirp->e2d_ino)], fs2h32(dirp->e2d_ino));
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass4.c,v 1.8 2005/08/19 02:07:18 christos Exp $ */
/* $NetBSD: pass4.c,v 1.9 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)pass4.c 8.1 (Berkeley) 6/5/93";
#else
__RCSID("$NetBSD: pass4.c,v 1.8 2005/08/19 02:07:18 christos Exp $");
__RCSID("$NetBSD: pass4.c,v 1.9 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -133,7 +133,7 @@ pass4(void)
break;
default:
errexit("BAD STATE %d FOR INODE I=%llu\n",
errexit("BAD STATE %d FOR INODE I=%llu",
statemap[inumber], (unsigned long long)inumber);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass5.c,v 1.14 2007/11/13 13:57:52 tsutsui Exp $ */
/* $NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94";
#else
__RCSID("$NetBSD: pass5.c,v 1.14 2007/11/13 13:57:52 tsutsui Exp $");
__RCSID("$NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -104,7 +104,7 @@ pass5(void)
ibmap = malloc(fs->e2fs_bsize);
bbmap = malloc(fs->e2fs_bsize);
if (ibmap == NULL || bbmap == NULL) {
errexit("out of memory\n");
errexit("out of memory");
}
for (c = 0; c < fs->e2fs_ncg; c++) {
@ -167,7 +167,7 @@ pass5(void)
break;
default:
errexit("BAD STATE %d FOR INODE I=%ld\n",
errexit("BAD STATE %d FOR INODE I=%ld",
statemap[j], j);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.24 2007/12/22 01:19:52 tsutsui Exp $ */
/* $NetBSD: setup.c,v 1.25 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
__RCSID("$NetBSD: setup.c,v 1.24 2007/12/22 01:19:52 tsutsui Exp $");
__RCSID("$NetBSD: setup.c,v 1.25 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -86,6 +86,7 @@ __RCSID("$NetBSD: setup.c,v 1.24 2007/12/22 01:19:52 tsutsui Exp $");
#include "fsck.h"
#include "extern.h"
#include "fsutil.h"
#include "exitvalues.h"
void badsb(int, const char *);
int calcsb(const char *, int, struct m_ext2fs *);
@ -137,7 +138,7 @@ setup(const char *dev)
sblk.b_un.b_buf = malloc(SBSIZE);
asblk.b_un.b_buf = malloc(SBSIZE);
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
errexit("cannot allocate space for superblock\n");
errexit("cannot allocate space for superblock");
if ((lp = getdisklabel((char *)NULL, fsreadfd)) != NULL)
dev_bsize = secsize = lp->d_secsize;
else
@ -218,7 +219,7 @@ setup(const char *dev)
sblock.e2fs_gd = malloc(sblock.e2fs_ngdb * sblock.e2fs_bsize);
if (sblock.e2fs_gd == NULL)
errexit("out of memory\n");
errexit("out of memory");
asked = 0;
for (i = 0; i < sblock.e2fs_ngdb; i++) {
if (bread(fsreadfd,
@ -229,7 +230,7 @@ setup(const char *dev)
sblock.e2fs_bsize) != 0 && !asked) {
pfatal("BAD SUMMARY INFORMATION");
if (reply("CONTINUE") == 0)
errexit("%s\n", "");
exit(FSCK_EXIT_CHECK_FAILED);
asked++;
}
}
@ -514,7 +515,7 @@ getdisklabel(const char *s, int fd)
if (s == NULL)
return NULL;
pwarn("ioctl (GCINFO): %s\n", strerror(errno));
errexit("%s: can't read disk label\n", s);
errexit("%s: can't read disk label", s);
}
return &lab;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: utilities.c,v 1.16 2008/02/23 21:41:48 christos Exp $ */
/* $NetBSD: utilities.c,v 1.17 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93";
#else
__RCSID("$NetBSD: utilities.c,v 1.16 2008/02/23 21:41:48 christos Exp $");
__RCSID("$NetBSD: utilities.c,v 1.17 2008/03/16 23:17:55 lukem Exp $");
#endif
#endif /* not lint */
@ -166,7 +166,7 @@ bufinit(void)
if (bp == NULL || bufp == NULL) {
if (i >= MINBUFS)
break;
errexit("cannot allocate buffer pool\n");
errexit("cannot allocate buffer pool");
}
bp->b_un.b_buf = bufp;
bp->b_prev = &bufhead;
@ -193,7 +193,7 @@ getdatablk(daddr_t blkno, long size)
if ((bp->b_flags & B_INUSE) == 0)
break;
if (bp == &bufhead)
errexit("deadlocked buffer pool\n");
errexit("deadlocked buffer pool");
getblk(bp, blkno, size);
diskreads++;
/* fall through */
@ -255,7 +255,7 @@ rwerror(const char *mesg, daddr_t blk)
printf("\n");
pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk);
if (reply("CONTINUE") == 0)
errexit("Program terminated\n");
errexit("Program terminated");
}
void
@ -286,7 +286,7 @@ ckfini(int markclean)
free((char *)bp);
}
if (bufhead.b_size != cnt)
errexit("Panic: lost %d buffers\n", bufhead.b_size - cnt);
errexit("Panic: lost %d buffers", bufhead.b_size - cnt);
pbp = pdirbp = (struct bufarea *)0;
if (markclean && (sblock.e2fs.e2fs_state & E2FS_ISCLEAN) == 0) {
/*
@ -530,7 +530,7 @@ dofix(struct inodesc *idesc, const char *msg)
return (0);
default:
errexit("UNKNOWN INODESC FIX MODE %d\n", idesc->id_fix);
errexit("UNKNOWN INODESC FIX MODE %d", idesc->id_fix);
}
/* NOTREACHED */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.22 2007/10/08 21:39:49 ad Exp $ */
/* $NetBSD: dir.c,v 1.23 2008/03/16 23:17:55 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -139,7 +139,7 @@ dirscan(struct inodesc *idesc)
struct uvnode *vp;
if (idesc->id_type != DATA)
errexit("wrong type to dirscan %d\n", idesc->id_type);
errexit("wrong type to dirscan %d", idesc->id_type);
if (idesc->id_entryno == 0 &&
(idesc->id_filesize & (DIRBLKSIZ - 1)) != 0)
idesc->id_filesize = roundup(idesc->id_filesize, DIRBLKSIZ);

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.33 2007/10/08 21:39:50 ad Exp $ */
/* $NetBSD: setup.c,v 1.34 2008/03/16 23:17:55 lukem Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -220,7 +220,7 @@ setup(const char *dev)
if (fs == NULL) {
if (preen)
printf("%s: ", cdevname());
errexit("BAD SUPER BLOCK OR IFILE INODE NOT FOUND\n");
errexit("BAD SUPER BLOCK OR IFILE INODE NOT FOUND");
}
if ((lp = getdisklabel((char *) NULL, fsreadfd)) != NULL)
dev_bsize = secsize = lp->d_secsize;