Make sure that the exit values are always sane, and use symbolic instead
of magic constants. Reviewed by go@
This commit is contained in:
parent
5ed7a7102f
commit
742b48d55e
|
@ -0,0 +1,41 @@
|
|||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define FSCK_EXIT_OK 0
|
||||
#define FSCK_EXIT_USAGE 1
|
||||
#define FSCK_EXIT_UNRESOLVED 2
|
||||
#define FSCK_EXIT_ROOT_CHANGED 4
|
||||
#define FSCK_EXIT_CHECK_FAILED 8
|
||||
#define FSCK_EXIT_SIGNALLED 12
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsck.c,v 1.46 2007/07/17 20:12:40 christos Exp $ */
|
||||
/* $NetBSD: fsck.c,v 1.47 2008/02/23 21:41:47 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fsck.c,v 1.46 2007/07/17 20:12:40 christos Exp $");
|
||||
__RCSID("$NetBSD: fsck.c,v 1.47 2008/02/23 21:41:47 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -63,6 +63,7 @@ __RCSID("$NetBSD: fsck.c,v 1.46 2007/07/17 20:12:40 christos Exp $");
|
|||
|
||||
#include "pathnames.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
static enum { IN_LIST, NOT_IN_LIST } which = NOT_IN_LIST;
|
||||
|
||||
|
@ -94,9 +95,10 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
struct fstab *fs;
|
||||
int i, rval = 0;
|
||||
int i, rval;
|
||||
const char *vfstype = NULL;
|
||||
char globopt[3];
|
||||
int ret = FSCK_EXIT_OK;
|
||||
|
||||
globopt[0] = '-';
|
||||
globopt[2] = '\0';
|
||||
|
@ -207,14 +209,17 @@ main(int argc, char *argv[])
|
|||
spec = fs->fs_spec;
|
||||
type = fs->fs_vfstype;
|
||||
if (BADTYPE(fs->fs_type))
|
||||
errx(1, "%s has unknown file system type.",
|
||||
errx(FSCK_EXIT_CHECK_FAILED,
|
||||
"%s has unknown file system type.",
|
||||
spec);
|
||||
}
|
||||
|
||||
rval |= checkfs(type, blockcheck(spec), *argv, NULL, NULL);
|
||||
rval = checkfs(type, blockcheck(spec), *argv, NULL, NULL);
|
||||
if (rval > ret)
|
||||
ret = rval;
|
||||
}
|
||||
|
||||
return rval;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -292,7 +297,7 @@ checkfs(const char *vfst, const char *spec, const char *mntpt, void *auxarg,
|
|||
if (optbuf)
|
||||
free(optbuf);
|
||||
free(argv);
|
||||
return (1);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
|
||||
case 0: /* Child. */
|
||||
if ((flags & CHECK_FORCE) == 0) {
|
||||
|
@ -310,14 +315,14 @@ checkfs(const char *vfst, const char *spec, const char *mntpt, void *auxarg,
|
|||
"%s: file system is mounted read-write on %s; not checking\n",
|
||||
spec, mntpt);
|
||||
if ((flags & CHECK_PREEN) && auxarg != NULL)
|
||||
_exit(0); /* fsck -p */
|
||||
_exit(FSCK_EXIT_OK); /* fsck -p */
|
||||
else
|
||||
_exit(1); /* fsck [[-p] ...] */
|
||||
_exit(FSCK_EXIT_CHECK_FAILED); /* fsck [[-p] ...] */
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & CHECK_DEBUG)
|
||||
_exit(0);
|
||||
_exit(FSCK_EXIT_OK);
|
||||
|
||||
/* Go find an executable. */
|
||||
edir = edirs;
|
||||
|
@ -339,7 +344,7 @@ checkfs(const char *vfst, const char *spec, const char *mntpt, void *auxarg,
|
|||
else
|
||||
warn("exec %s", execname);
|
||||
}
|
||||
_exit(1);
|
||||
_exit(FSCK_EXIT_CHECK_FAILED);
|
||||
/* NOTREACHED */
|
||||
|
||||
default: /* Parent. */
|
||||
|
@ -349,26 +354,26 @@ checkfs(const char *vfst, const char *spec, const char *mntpt, void *auxarg,
|
|||
|
||||
if (pidp) {
|
||||
*pidp = pid;
|
||||
return 0;
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
if (waitpid(pid, &status, 0) < 0) {
|
||||
warn("waitpid");
|
||||
return (1);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
|
||||
if (WIFEXITED(status)) {
|
||||
if (WEXITSTATUS(status) != 0)
|
||||
return (WEXITSTATUS(status));
|
||||
return WEXITSTATUS(status);
|
||||
}
|
||||
else if (WIFSIGNALED(status)) {
|
||||
warnx("%s: %s", spec, strsignal(WTERMSIG(status)));
|
||||
return (1);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -557,5 +562,5 @@ usage(void)
|
|||
|
||||
(void)fprintf(stderr, "usage: %s %s [special|node]...\n",
|
||||
getprogname(), common);
|
||||
exit(1);
|
||||
exit(FSCK_EXIT_USAGE);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsutil.c,v 1.16 2006/08/26 18:14:28 christos Exp $ */
|
||||
/* $NetBSD: fsutil.c,v 1.17 2008/02/23 21:41:47 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fsutil.c,v 1.16 2006/08/26 18:14:28 christos Exp $");
|
||||
__RCSID("$NetBSD: fsutil.c,v 1.17 2008/02/23 21:41:47 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -48,6 +48,7 @@ __RCSID("$NetBSD: fsutil.c,v 1.16 2006/08/26 18:14:28 christos Exp $");
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
static const char *dev = NULL;
|
||||
static int hot = 0;
|
||||
|
@ -86,7 +87,7 @@ errexit(const char *fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
(void) vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -114,7 +115,7 @@ vmsg(int fatal, const char *fmt, va_list ap)
|
|||
(void) printf(
|
||||
"%s: UNEXPECTED INCONSISTENCY; RUN %s MANUALLY.\n",
|
||||
dev, getprogname());
|
||||
exit(8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,7 @@ panic(const char *fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
vmsg(1, fmt, ap);
|
||||
va_end(ap);
|
||||
exit(8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: preen.c,v 1.29 2006/08/26 21:54:05 christos Exp $ */
|
||||
/* $NetBSD: preen.c,v 1.30 2008/02/23 21:41:47 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: preen.c,v 1.29 2006/08/26 21:54:05 christos Exp $");
|
||||
__RCSID("$NetBSD: preen.c,v 1.30 2008/02/23 21:41:47 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -56,6 +56,7 @@ __RCSID("$NetBSD: preen.c,v 1.29 2006/08/26 21:54:05 christos Exp $");
|
|||
#include <util.h>
|
||||
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
struct partentry {
|
||||
TAILQ_ENTRY(partentry) p_entries;
|
||||
|
@ -94,17 +95,17 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
int ret, pid, retcode, passno, sumstatus, status;
|
||||
void *auxarg;
|
||||
const char *name;
|
||||
int error = 0;
|
||||
int error = FSCK_EXIT_OK;
|
||||
|
||||
TAILQ_INIT(&badh);
|
||||
TAILQ_INIT(&diskh);
|
||||
|
||||
sumstatus = 0;
|
||||
sumstatus = FSCK_EXIT_OK;
|
||||
|
||||
for (passno = 1; passno <= 2; passno++) {
|
||||
if (setfsent() == 0) {
|
||||
warnx("Can't open checklist file: %s", _PATH_FSTAB);
|
||||
return (8);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
while ((fs = getfsent()) != 0) {
|
||||
if ((auxarg = (*docheck)(fs)) == NULL)
|
||||
|
@ -118,7 +119,7 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
(passno == 1 && fs->fs_passno == 1)) {
|
||||
if (name == NULL) {
|
||||
if (flags & CHECK_PREEN)
|
||||
return 8;
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
@ -127,15 +128,15 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
|
||||
if (sumstatus) {
|
||||
if ((flags & CHECK_NOFIX) == 0)
|
||||
return (sumstatus);
|
||||
else
|
||||
error |= sumstatus;
|
||||
return sumstatus;
|
||||
else if (error < sumstatus)
|
||||
error = sumstatus;
|
||||
}
|
||||
} else if (passno == 2 && fs->fs_passno > 1) {
|
||||
if (name == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
"BAD DISK NAME %s\n", fs->fs_spec);
|
||||
sumstatus |= 8;
|
||||
sumstatus = FSCK_EXIT_CHECK_FAILED;
|
||||
continue;
|
||||
}
|
||||
addpart(fs->fs_vfstype, name, fs->fs_file,
|
||||
|
@ -159,8 +160,8 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
if ((ret = startdisk(nextdisk, checkit)) != 0) {
|
||||
if ((flags & CHECK_NOFIX) == 0)
|
||||
return ret;
|
||||
else
|
||||
error |= ret;
|
||||
else if (error < ret)
|
||||
error = ret;
|
||||
}
|
||||
nextdisk = TAILQ_NEXT(nextdisk, d_entries);
|
||||
}
|
||||
|
@ -193,7 +194,7 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
"%s: %s (%s): EXITED WITH SIGNAL %d\n",
|
||||
p->p_type, p->p_devname, p->p_mntpt,
|
||||
WTERMSIG(status));
|
||||
retcode = 8;
|
||||
retcode = FSCK_EXIT_SIGNALLED;
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&d->d_part, p, p_entries);
|
||||
|
@ -218,8 +219,8 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
{
|
||||
if ((flags & CHECK_NOFIX) == 0)
|
||||
return ret;
|
||||
else
|
||||
error |= ret;
|
||||
else if (error < ret)
|
||||
error = ret;
|
||||
}
|
||||
}
|
||||
} else if (nrun < maxrun && nrun < ndisks) {
|
||||
|
@ -236,8 +237,8 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
{
|
||||
if ((flags & CHECK_NOFIX) == 0)
|
||||
return ret;
|
||||
else
|
||||
error |= ret;
|
||||
else if (error < ret)
|
||||
error = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +246,7 @@ checkfstab(int flags, int maxrun, void *(*docheck)(struct fstab *),
|
|||
if (sumstatus) {
|
||||
p = TAILQ_FIRST(&badh);
|
||||
if (p == NULL)
|
||||
return (sumstatus);
|
||||
return sumstatus;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
"THE FOLLOWING FILE SYSTEM%s HAD AN %s\n\t",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.26 2007/07/16 17:06:52 pooka Exp $ */
|
||||
/* $NetBSD: main.c,v 1.27 2008/02/23 21:41:48 christos 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.26 2007/07/16 17:06:52 pooka Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.27 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -90,19 +90,20 @@ __RCSID("$NetBSD: main.c,v 1.26 2007/07/16 17:06:52 pooka Exp $");
|
|||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
int returntosingle;
|
||||
int returntosingle = 0;
|
||||
|
||||
|
||||
static int argtoi(int, const char *, const char *, int);
|
||||
static int checkfilesys(const char *, char *, long, int);
|
||||
static void usage(void);
|
||||
static void usage(void) __dead;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch;
|
||||
int ret = 0;
|
||||
int ret = FSCK_EXIT_OK;
|
||||
|
||||
sync();
|
||||
skipclean = 1;
|
||||
|
@ -166,13 +167,13 @@ main(int argc, char *argv[])
|
|||
if (preen)
|
||||
(void)signal(SIGQUIT, catchquit);
|
||||
|
||||
while (argc-- > 0)
|
||||
(void)checkfilesys(blockcheck(*argv++), 0, 0L, 0);
|
||||
while (argc-- > 0) {
|
||||
int nret = checkfilesys(blockcheck(*argv++), 0, 0L, 0);
|
||||
if (ret < nret)
|
||||
ret = nret;
|
||||
}
|
||||
|
||||
if (returntosingle)
|
||||
ret = 2;
|
||||
|
||||
exit(ret);
|
||||
return returntosingle ? FSCK_EXIT_UNRESOLVED : ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -209,7 +210,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
if (preen)
|
||||
pfatal("CAN'T CHECK FILE SYSTEM.");
|
||||
case -1:
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
/*
|
||||
* 1: scan inodes tallying blocks used
|
||||
|
@ -310,7 +311,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
free(statemap);
|
||||
free((char *)lncntp);
|
||||
if (!fsmodified)
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
if (!preen)
|
||||
printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
|
||||
if (rerun)
|
||||
|
@ -324,23 +325,21 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
if (statvfs("/", &stfs_buf) == 0) {
|
||||
long flags = stfs_buf.f_flag;
|
||||
struct ufs_args args;
|
||||
int ret;
|
||||
|
||||
if (flags & MNT_RDONLY) {
|
||||
args.fspec = 0;
|
||||
flags |= MNT_UPDATE | MNT_RELOAD;
|
||||
ret = mount(MOUNT_EXT2FS, "/", flags,
|
||||
&args, sizeof args);
|
||||
if (ret == 0)
|
||||
return(0);
|
||||
if (mount(MOUNT_EXT2FS, "/", flags,
|
||||
&args, sizeof args) == 0)
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
}
|
||||
if (!preen)
|
||||
printf("\n***** REBOOT NOW *****\n");
|
||||
sync();
|
||||
return (4);
|
||||
return FSCK_EXIT_ROOT_CHANGED;
|
||||
}
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -348,8 +347,8 @@ usage(void)
|
|||
{
|
||||
|
||||
(void) fprintf(stderr,
|
||||
"usage: %s [-dfnpy] [-b block] [-c level] [-m mode] filesystem ...\n",
|
||||
"Usage: %s [-dfnpy] [-b block] [-c level] [-m mode] filesystem ...\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
exit(FSCK_EXIT_USAGE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: preen.c,v 1.8 2006/06/05 16:56:24 christos Exp $ */
|
||||
/* $NetBSD: preen.c,v 1.9 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -63,7 +63,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)preen.c 8.3 (Berkeley) 12/6/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: preen.c,v 1.8 2006/06/05 16:56:24 christos Exp $");
|
||||
__RCSID("$NetBSD: preen.c,v 1.9 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -108,12 +108,12 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
long auxdata;
|
||||
char *name;
|
||||
|
||||
sumstatus = 0;
|
||||
sumstatus = FSCK_EXIT_OK;
|
||||
for (passno = 1; passno <= 2; passno++) {
|
||||
if (setfsent() == 0) {
|
||||
fprintf(stderr, "Can't open checklist file: %s\n",
|
||||
(void)fprintf(stderr, "Can't open checklist file: %s\n",
|
||||
_PATH_FSTAB);
|
||||
return (8);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
while ((fsp = getfsent()) != 0) {
|
||||
if ((auxdata = (*docheck)(fsp)) == 0)
|
||||
|
@ -122,21 +122,21 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
if (name = blockcheck(fsp->fs_spec)) {
|
||||
if (sumstatus = (*chkit)(name,
|
||||
fsp->fs_file, auxdata, 0))
|
||||
return (sumstatus);
|
||||
return sumstatus;
|
||||
} else if (preen)
|
||||
return (8);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
} else if (passno == 2 && fsp->fs_passno > 1) {
|
||||
if ((name = blockcheck(fsp->fs_spec)) == NULL) {
|
||||
fprintf(stderr, "BAD DISK NAME %s\n",
|
||||
fsp->fs_spec);
|
||||
sumstatus |= 8;
|
||||
sumstatus = FSCK_EXIT_CHECK_FAILED;
|
||||
continue;
|
||||
}
|
||||
addpart(name, fsp->fs_file, auxdata);
|
||||
}
|
||||
}
|
||||
if (preen == 0)
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
if (preen) {
|
||||
if (maxrun == 0)
|
||||
|
@ -148,7 +148,7 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
while (ret = startdisk(nextdisk, chkit) && nrun > 0)
|
||||
sleep(10);
|
||||
if (ret)
|
||||
return (ret);
|
||||
return ret;
|
||||
nextdisk = nextdisk->next;
|
||||
}
|
||||
while ((pid = wait(&status)) != -1) {
|
||||
|
@ -167,10 +167,11 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
printf("%s (%s): EXITED WITH SIGNAL %d\n",
|
||||
dk->part->name, dk->part->fsname,
|
||||
WTERMSIG(status));
|
||||
retcode = 8;
|
||||
retcode = FSCK_EXIT_SIGNALLED;
|
||||
}
|
||||
if (retcode != 0) {
|
||||
sumstatus |= retcode;
|
||||
if (sumstatus < retcode)
|
||||
sumstatus = retcode;
|
||||
*badnext = dk->part;
|
||||
badnext = &dk->part->next;
|
||||
dk->part = dk->part->next;
|
||||
|
@ -188,7 +189,7 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
nrun > 0)
|
||||
sleep(10);
|
||||
if (ret)
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
} else if (nrun < maxrun && nrun < ndisks) {
|
||||
for ( ;; ) {
|
||||
|
@ -202,22 +203,22 @@ checkfstab(int preen, int maxrun, int (*docheck)(), int (*chkit)())
|
|||
nrun > 0)
|
||||
sleep(10);
|
||||
if (ret)
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sumstatus) {
|
||||
if (badlist == 0)
|
||||
return (sumstatus);
|
||||
return sumstatus;
|
||||
fprintf(stderr, "THE FOLLOWING FILE SYSTEM%s HAD AN %s\n\t",
|
||||
badlist->next ? "S" : "", "UNEXPECTED INCONSISTENCY:");
|
||||
for (pt = badlist; pt; pt = pt->next)
|
||||
fprintf(stderr, "%s (%s)%s", pt->name, pt->fsname,
|
||||
pt->next ? ", " : "\n");
|
||||
return (sumstatus);
|
||||
return sumstatus;
|
||||
}
|
||||
(void)endfsent();
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
struct disk *
|
||||
|
@ -242,12 +243,12 @@ finddisk(char *name)
|
|||
}
|
||||
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
exit (8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
dk = *dkp;
|
||||
if ((dk->name = malloc(len + 1)) == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
exit (8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
(void)strncpy(dk->name, name, len);
|
||||
dk->name[len] = '\0';
|
||||
|
@ -271,16 +272,16 @@ addpart(char *name, char *fsname, long auxdata)
|
|||
}
|
||||
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
exit (8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
pt = *ppt;
|
||||
if ((pt->name = strdup(name)) == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
exit (8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
if ((pt->fsname = strdup(fsname)) == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
exit (8);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
pt->next = NULL;
|
||||
pt->auxdata = auxdata;
|
||||
|
@ -294,12 +295,12 @@ startdisk(struct disk *dk, int (*checkit)())
|
|||
dk->pid = fork();
|
||||
if (dk->pid < 0) {
|
||||
perr("fork");
|
||||
return (8);
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
if (dk->pid == 0)
|
||||
exit((*checkit)(pt->name, pt->fsname, pt->auxdata, 1));
|
||||
nrun++;
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.15 2007/02/08 21:36:58 drochner Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.16 2008/02/23 21:41:48 christos 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.15 2007/02/08 21:36:58 drochner Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.16 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -83,6 +83,7 @@ __RCSID("$NetBSD: utilities.c,v 1.15 2007/02/08 21:36:58 drochner Exp $");
|
|||
#include "fsutil.h"
|
||||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
long diskreads, totalreads; /* Disk cache statistics */
|
||||
|
||||
|
@ -466,7 +467,7 @@ void
|
|||
catch(int n)
|
||||
{
|
||||
ckfini(0);
|
||||
exit(12);
|
||||
exit(FSCK_EXIT_SIGNALLED);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.49 2006/10/16 03:09:06 christos Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.50 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.49 2006/10/16 03:09:06 christos Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.50 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -161,7 +161,7 @@ dirscan(struct inodesc *idesc)
|
|||
#endif
|
||||
|
||||
if (idesc->id_type != DATA)
|
||||
errx(EEXIT, "wrong type to dirscan %d", 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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fsck.h,v 1.45 2006/04/21 15:00:49 skrll Exp $ */
|
||||
/* $NetBSD: fsck.h,v 1.46 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -315,8 +315,6 @@ struct ufs2_dinode ufs2_zino;
|
|||
#define ALTERED 0x08
|
||||
#define FOUND 0x10
|
||||
|
||||
#define EEXIT 8 /* Standard error exit. */
|
||||
|
||||
/* some inline functs to help the byte-swapping mess */
|
||||
static inline u_int16_t iswap16 (u_int16_t);
|
||||
static inline u_int32_t iswap32 (u_int32_t);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inode.c,v 1.58 2007/04/12 05:19:18 chs Exp $ */
|
||||
/* $NetBSD: inode.c,v 1.59 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: inode.c,v 1.58 2007/04/12 05:19:18 chs Exp $");
|
||||
__RCSID("$NetBSD: inode.c,v 1.59 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -323,7 +323,7 @@ ginode(ino_t inumber)
|
|||
int blkoff;
|
||||
|
||||
if (inumber < ROOTINO || inumber > maxino)
|
||||
errx(EEXIT, "bad inode number %llu to ginode",
|
||||
errexit("bad inode number %llu to ginode",
|
||||
(unsigned long long)inumber);
|
||||
if (startinum == 0 ||
|
||||
inumber < startinum || inumber >= startinum + INOPB(sblock)) {
|
||||
|
@ -396,7 +396,7 @@ getnextinode(ino_t inumber)
|
|||
union dinode *ret;
|
||||
|
||||
if (inumber != nextino++ || inumber > lastvalidinum)
|
||||
errx(EEXIT, "bad inode number %llu to nextinode",
|
||||
errexit("bad inode number %llu to nextinode",
|
||||
(unsigned long long)inumber);
|
||||
|
||||
if (inumber >= lastinum) {
|
||||
|
@ -430,7 +430,7 @@ setinodebuf(ino_t inum)
|
|||
{
|
||||
|
||||
if (inum % sblock->fs_ipg != 0)
|
||||
errx(EEXIT, "bad inode number %llu to setinodebuf",
|
||||
errexit("bad inode number %llu to setinodebuf",
|
||||
(unsigned long long)inum);
|
||||
|
||||
lastvalidinum = inum + sblock->fs_ipg - 1;
|
||||
|
@ -453,7 +453,7 @@ setinodebuf(ino_t inum)
|
|||
}
|
||||
if (inodebuf == NULL &&
|
||||
(inodebuf = malloc((unsigned)inobufsize)) == NULL)
|
||||
errx(EEXIT, "Cannot allocate space for inode buffer");
|
||||
errexit("Cannot allocate space for inode buffer");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -513,7 +513,7 @@ cacheino(union dinode *dp, ino_t inumber)
|
|||
ninpsort = (struct inoinfo **)realloc((char *)inpsort,
|
||||
(unsigned)(listmax + 100) * sizeof(struct inoinfo *));
|
||||
if (inpsort == NULL)
|
||||
errx(EEXIT, "cannot increase directory list");
|
||||
errexit("cannot increase directory list");
|
||||
inpsort = ninpsort;
|
||||
listmax += 100;
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ getinoinfo(ino_t inumber)
|
|||
continue;
|
||||
return (inp);
|
||||
}
|
||||
errx(EEXIT, "cannot find inode %llu", (unsigned long long)inumber);
|
||||
errexit("cannot find inode %llu", (unsigned long long)inumber);
|
||||
return ((struct inoinfo *)0);
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ blkerror(ino_t ino, const char *type, daddr_t blk)
|
|||
return;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "BAD STATE %d TO BLKERR", info->ino_state);
|
||||
errexit("BAD STATE %d TO BLKERR", info->ino_state);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.66 2007/07/16 17:06:52 pooka Exp $ */
|
||||
/* $NetBSD: main.c,v 1.67 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1986, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.66 2007/07/16 17:06:52 pooka Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.67 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -66,9 +66,10 @@ __RCSID("$NetBSD: main.c,v 1.66 2007/07/16 17:06:52 pooka Exp $");
|
|||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
int returntosingle;
|
||||
int progress = 0;
|
||||
int returntosingle = 0;
|
||||
|
||||
static int argtoi(int, const char *, const char *, int);
|
||||
static int checkfilesys(const char *, char *, long, int);
|
||||
|
@ -79,7 +80,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
struct rlimit r;
|
||||
int ch;
|
||||
int ret = 0;
|
||||
int ret = FSCK_EXIT_OK;
|
||||
|
||||
if (getrlimit(RLIMIT_DATA, &r) == 0) {
|
||||
r.rlim_cur = r.rlim_max;
|
||||
|
@ -116,7 +117,8 @@ main(int argc, char *argv[])
|
|||
cvtlevel = argtoi('c', "conversion level", optarg, 10);
|
||||
if (cvtlevel > 4) {
|
||||
cvtlevel = 4;
|
||||
warnx("Using maximum conversion level of %d\n",cvtlevel);
|
||||
warnx("Using maximum conversion level of %d\n",
|
||||
cvtlevel);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -135,7 +137,8 @@ main(int argc, char *argv[])
|
|||
case 'm':
|
||||
lfmode = argtoi('m', "mode", optarg, 8);
|
||||
if (lfmode &~ 07777)
|
||||
errx(EEXIT, "bad mode to -m: %o", lfmode);
|
||||
errx(FSCK_EXIT_USAGE, "bad mode to -m: %o",
|
||||
lfmode);
|
||||
printf("** lost+found creation mode %o\n", lfmode);
|
||||
break;
|
||||
|
||||
|
@ -192,15 +195,15 @@ main(int argc, char *argv[])
|
|||
|
||||
if (path == NULL)
|
||||
pfatal("Can't check %s\n", *argv);
|
||||
else
|
||||
(void)checkfilesys(blockcheck(*argv), 0, 0L, 0);
|
||||
else {
|
||||
int nret = checkfilesys(blockcheck(*argv), 0, 0L, 0);
|
||||
if (ret < nret)
|
||||
ret = nret;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (returntosingle)
|
||||
ret = 2;
|
||||
|
||||
exit(ret);
|
||||
return returntosingle ? FSCK_EXIT_UNRESOLVED : ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -211,7 +214,8 @@ argtoi(int flag, const char *req, const char *str, int base)
|
|||
|
||||
ret = (int)strtol(str, &cp, base);
|
||||
if (cp == str || *cp)
|
||||
errx(EEXIT, "-%c flag requires a %s", flag, req);
|
||||
errx(FSCK_EXIT_USAGE, "-%c flag requires a %s",
|
||||
flag, req);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -257,7 +261,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
pfatal("CAN'T CHECK FILE SYSTEM.");
|
||||
/* fall through */
|
||||
case -1:
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
/*
|
||||
* Cleared if any questions answered no. Used to decide if
|
||||
|
@ -418,7 +422,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
returntosingle = 1;
|
||||
}
|
||||
if (!fsmodified)
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
if (!preen)
|
||||
pwarn("\n***** FILE SYSTEM WAS MODIFIED *****\n");
|
||||
if (rerun)
|
||||
|
@ -432,23 +436,21 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
if (statvfs("/", &stfs_buf) == 0) {
|
||||
long flags = stfs_buf.f_flag;
|
||||
struct ufs_args args;
|
||||
int ret;
|
||||
|
||||
if (flags & MNT_RDONLY) {
|
||||
args.fspec = 0;
|
||||
flags |= MNT_UPDATE | MNT_RELOAD;
|
||||
ret = mount(MOUNT_FFS, "/", flags,
|
||||
&args, sizeof args);
|
||||
if (ret == 0)
|
||||
return(0);
|
||||
if (mount(MOUNT_FFS, "/", flags,
|
||||
&args, sizeof args) == 0)
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
}
|
||||
if (!preen)
|
||||
pwarn("\n***** REBOOT NOW *****\n");
|
||||
sync();
|
||||
return (4);
|
||||
return FSCK_EXIT_ROOT_CHANGED;
|
||||
}
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -459,6 +461,6 @@ usage(void)
|
|||
"usage: %s [-adFfnPpqy] [-B be|le] [-b block] [-c level] [-m mode]"
|
||||
" filesystem ...\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
exit(FSCK_EXIT_USAGE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass1.c,v 1.43 2006/11/14 21:01:46 apb Exp $ */
|
||||
/* $NetBSD: pass1.c,v 1.44 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass1.c,v 1.43 2006/11/14 21:01:46 apb Exp $");
|
||||
__RCSID("$NetBSD: pass1.c,v 1.44 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -56,6 +56,7 @@ __RCSID("$NetBSD: pass1.c,v 1.43 2006/11/14 21:01:46 apb Exp $");
|
|||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
static daddr_t badblk;
|
||||
static daddr_t dupblk;
|
||||
|
@ -154,7 +155,7 @@ pass1(void)
|
|||
if (info == NULL) {
|
||||
pfatal("cannot alloc %u bytes for inoinfo\n",
|
||||
(unsigned)(sizeof(struct inostat) * inosused));
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
inostathead[c].il_stat = info;
|
||||
/*
|
||||
|
@ -190,7 +191,7 @@ pass1(void)
|
|||
if (info == NULL) {
|
||||
pfatal("cannot alloc %u bytes for inoinfo\n",
|
||||
(unsigned)(sizeof(struct inostat) * inosused));
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
memmove(info, inostathead[c].il_stat, inosused * sizeof(*info));
|
||||
free(inostathead[c].il_stat);
|
||||
|
@ -288,7 +289,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||
if (bread(fsreadfd, symbuf,
|
||||
fsbtodb(sblock, iswap32(DIP(dp, db[0]))),
|
||||
(long)secsize) != 0)
|
||||
errx(EEXIT, "cannot read symlink");
|
||||
errexit("cannot read symlink");
|
||||
if (debug) {
|
||||
symbuf[size] = 0;
|
||||
printf("convert symlink %llu(%s) "
|
||||
|
@ -364,7 +365,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
|
|||
pfatal("LINK COUNT TABLE OVERFLOW");
|
||||
if (reply("CONTINUE") == 0) {
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
} else {
|
||||
zlnp->zlncnt = inumber;
|
||||
|
@ -478,7 +479,7 @@ pass1check(struct inodesc *idesc)
|
|||
else if (reply("CONTINUE") == 0) {
|
||||
markclean = 0;
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
return (STOP);
|
||||
}
|
||||
|
@ -499,7 +500,7 @@ pass1check(struct inodesc *idesc)
|
|||
else if (reply("CONTINUE") == 0) {
|
||||
markclean = 0;
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
return (STOP);
|
||||
}
|
||||
|
@ -510,7 +511,7 @@ pass1check(struct inodesc *idesc)
|
|||
if (reply("CONTINUE") == 0) {
|
||||
markclean = 0;
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
return (STOP);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass2.c,v 1.44 2006/11/14 21:01:46 apb Exp $ */
|
||||
/* $NetBSD: pass2.c,v 1.45 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass2.c,v 1.44 2006/11/14 21:01:46 apb Exp $");
|
||||
__RCSID("$NetBSD: pass2.c,v 1.45 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -53,6 +53,7 @@ __RCSID("$NetBSD: pass2.c,v 1.44 2006/11/14 21:01:46 apb Exp $");
|
|||
#include "fsck.h"
|
||||
#include "fsutil.h"
|
||||
#include "extern.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
#define MINDIRSIZE (sizeof (struct dirtemplate))
|
||||
|
||||
|
@ -79,10 +80,10 @@ pass2(void)
|
|||
if (reply("ALLOCATE") == 0) {
|
||||
markclean = 0;
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
errx(EEXIT, "CANNOT ALLOCATE ROOT INODE");
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
|
||||
case DCLEAR:
|
||||
|
@ -90,13 +91,13 @@ pass2(void)
|
|||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
errx(EEXIT, "CANNOT ALLOCATE ROOT INODE");
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
}
|
||||
markclean = 0;
|
||||
if (reply("CONTINUE") == 0) {
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -106,13 +107,13 @@ pass2(void)
|
|||
if (reply("REALLOCATE")) {
|
||||
freeino(ROOTINO);
|
||||
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
|
||||
errx(EEXIT, "CANNOT ALLOCATE ROOT INODE");
|
||||
errexit("CANNOT ALLOCATE ROOT INODE");
|
||||
break;
|
||||
}
|
||||
if (reply("FIX") == 0) {
|
||||
markclean = 0;
|
||||
ckfini();
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
dp = ginode(ROOTINO);
|
||||
DIP_SET(dp, mode,
|
||||
|
@ -124,7 +125,7 @@ pass2(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "BAD STATE %d FOR ROOT INODE", rinfo->ino_state);
|
||||
errexit("BAD STATE %d FOR ROOT INODE", rinfo->ino_state);
|
||||
}
|
||||
if (newinofmt) {
|
||||
info = inoinfo(WINO);
|
||||
|
@ -590,7 +591,7 @@ again:
|
|||
break;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "BAD STATE %d FOR INODE I=%d",
|
||||
errexit("BAD STATE %d FOR INODE I=%d",
|
||||
info->ino_state, iswap32(dirp->d_ino));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass4.c,v 1.23 2006/11/14 21:01:46 apb Exp $ */
|
||||
/* $NetBSD: pass4.c,v 1.24 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass4.c,v 1.23 2006/11/14 21:01:46 apb Exp $");
|
||||
__RCSID("$NetBSD: pass4.c,v 1.24 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -122,7 +122,7 @@ pass4(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "BAD STATE %d FOR INODE I=%llu",
|
||||
errexit("BAD STATE %d FOR INODE I=%llu",
|
||||
info->ino_state,
|
||||
(unsigned long long)inumber);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pass5.c,v 1.47 2006/11/14 21:01:46 apb Exp $ */
|
||||
/* $NetBSD: pass5.c,v 1.48 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: pass5.c,v 1.47 2006/11/14 21:01:46 apb Exp $");
|
||||
__RCSID("$NetBSD: pass5.c,v 1.48 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -112,7 +112,7 @@ pass5(void)
|
|||
ncgsize = fragroundup(fs, CGSIZE(fs));
|
||||
ncg = realloc(cgrp, ncgsize);
|
||||
if (ncg == NULL)
|
||||
errx(EEXIT,
|
||||
errexit(
|
||||
"cannot reallocate cg space");
|
||||
cg = cgrp = ncg;
|
||||
fs->fs_cgsize = ncgsize;
|
||||
|
@ -184,7 +184,7 @@ pass5(void)
|
|||
break;
|
||||
|
||||
default:
|
||||
errx(EEXIT, "UNKNOWN ROTATIONAL TABLE FORMAT %d",
|
||||
errexit("UNKNOWN ROTATIONAL TABLE FORMAT %d",
|
||||
fs->fs_old_postblformat);
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ pass5(void)
|
|||
default:
|
||||
if (j < ROOTINO)
|
||||
break;
|
||||
errx(EEXIT, "BAD STATE %d FOR INODE I=%ld",
|
||||
errexit("BAD STATE %d FOR INODE I=%ld",
|
||||
info->ino_state, (long)j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: setup.c,v 1.81 2007/08/22 16:30:28 christos Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.82 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: setup.c,v 1.81 2007/08/22 16:30:28 christos Exp $");
|
||||
__RCSID("$NetBSD: setup.c,v 1.82 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -62,6 +62,7 @@ __RCSID("$NetBSD: setup.c,v 1.81 2007/08/22 16:30:28 christos Exp $");
|
|||
#include "extern.h"
|
||||
#include "fsutil.h"
|
||||
#include "partutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
|
||||
|
||||
|
@ -126,7 +127,7 @@ setup(const char *dev)
|
|||
altsblock = malloc(SBLOCKSIZE);
|
||||
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL ||
|
||||
sblock == NULL || altsblock == NULL)
|
||||
errx(EEXIT, "cannot allocate space for superblock");
|
||||
errexit("Cannot allocate space for superblock");
|
||||
if (!forceimage && getdiskinfo(dev, fsreadfd, NULL, &geo, &dkw) != -1)
|
||||
dev_bsize = secsize = geo.dg_secsize;
|
||||
else
|
||||
|
@ -404,7 +405,7 @@ setup(const char *dev)
|
|||
pfatal("BAD SUMMARY INFORMATION");
|
||||
if (reply("CONTINUE") == 0) {
|
||||
markclean = 0;
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
asked++;
|
||||
}
|
||||
|
@ -670,9 +671,11 @@ readsb(int listerr)
|
|||
}
|
||||
if (doswap) {
|
||||
if (preen)
|
||||
errx(EEXIT, "incompatible options -B and -p");
|
||||
errx(FSCK_EXIT_USAGE,
|
||||
"Incompatible options -B and -p");
|
||||
if (nflag)
|
||||
errx(EEXIT, "incompatible options -B and -n");
|
||||
errx(FSCK_EXIT_USAGE,
|
||||
"Incompatible options -B and -n");
|
||||
if (endian == LITTLE_ENDIAN) {
|
||||
if (!reply("CONVERT TO LITTLE ENDIAN"))
|
||||
return 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.54 2007/02/08 21:36:58 drochner Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.55 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: utilities.c,v 1.54 2007/02/08 21:36:58 drochner Exp $");
|
||||
__RCSID("$NetBSD: utilities.c,v 1.55 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -59,6 +59,7 @@ __RCSID("$NetBSD: utilities.c,v 1.54 2007/02/08 21:36:58 drochner Exp $");
|
|||
#include "fsutil.h"
|
||||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
long diskreads, totalreads; /* Disk cache statistics */
|
||||
|
||||
|
@ -137,12 +138,12 @@ bufinit(void)
|
|||
pbp = pdirbp = (struct bufarea *)0;
|
||||
bufp = malloc((unsigned int)sblock->fs_bsize);
|
||||
if (bufp == 0)
|
||||
errx(EEXIT, "cannot allocate buffer pool");
|
||||
errexit("cannot allocate buffer pool");
|
||||
cgblk.b_un.b_buf = bufp;
|
||||
initbarea(&cgblk);
|
||||
bufp = malloc((unsigned int)APPLEUFS_LABEL_SIZE);
|
||||
if (bufp == 0)
|
||||
errx(EEXIT, "cannot allocate buffer pool");
|
||||
errexit("cannot allocate buffer pool");
|
||||
appleufsblk.b_un.b_buf = bufp;
|
||||
initbarea(&appleufsblk);
|
||||
bufhead.b_next = bufhead.b_prev = &bufhead;
|
||||
|
@ -160,7 +161,7 @@ bufinit(void)
|
|||
free(bufp);
|
||||
break;
|
||||
}
|
||||
errx(EEXIT, "cannot allocate buffer pool");
|
||||
errexit("cannot allocate buffer pool");
|
||||
}
|
||||
bp->b_un.b_buf = bufp;
|
||||
bp->b_prev = &bufhead;
|
||||
|
@ -187,7 +188,7 @@ getdatablk(daddr_t blkno, long size)
|
|||
if ((bp->b_flags & B_INUSE) == 0)
|
||||
break;
|
||||
if (bp == &bufhead)
|
||||
errx(EEXIT, "deadlocked buffer pool");
|
||||
errexit("deadlocked buffer pool");
|
||||
/* fall through */
|
||||
foundit:
|
||||
getblk(bp, blkno, size);
|
||||
|
@ -256,7 +257,7 @@ rwerror(const char *mesg, daddr_t blk)
|
|||
printf("\n");
|
||||
pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk);
|
||||
if (reply("CONTINUE") == 0)
|
||||
exit(EEXIT);
|
||||
exit(FSCK_EXIT_CHECK_FAILED);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -293,7 +294,7 @@ ckfini(void)
|
|||
free((char *)bp);
|
||||
}
|
||||
if (bufhead.b_size != cnt)
|
||||
errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt);
|
||||
errexit("Panic: lost %d buffers", bufhead.b_size - cnt);
|
||||
pbp = pdirbp = (struct bufarea *)0;
|
||||
if (markclean && (sblock->fs_clean & FS_ISCLEAN) == 0) {
|
||||
/*
|
||||
|
@ -505,7 +506,7 @@ catch(int sig)
|
|||
markclean = 0;
|
||||
ckfini();
|
||||
}
|
||||
exit(12);
|
||||
exit(FSCK_EXIT_SIGNALLED);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -573,7 +574,7 @@ dofix(struct inodesc *idesc, const char *msg)
|
|||
return (0);
|
||||
|
||||
default:
|
||||
errx(EEXIT, "UNKNOWN INODESC FIX MODE %d", idesc->id_fix);
|
||||
errexit("UNKNOWN INODESC FIX MODE %d", idesc->id_fix);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return (0);
|
||||
|
@ -605,7 +606,7 @@ inoinfo(ino_t inum)
|
|||
int iloff;
|
||||
|
||||
if (inum > maxino)
|
||||
errx(EEXIT, "inoinfo: inumber %llu out of range",
|
||||
errexit("inoinfo: inumber %llu out of range",
|
||||
(unsigned long long)inum);
|
||||
ilp = &inostathead[inum / sblock->fs_ipg];
|
||||
iloff = inum % sblock->fs_ipg;
|
||||
|
@ -626,7 +627,7 @@ sb_oldfscompat_read(struct fs *fs, struct fs **fssave)
|
|||
if (!*fssave)
|
||||
*fssave = malloc(sizeof(struct fs));
|
||||
if (!*fssave)
|
||||
errx(EEXIT, "cannot allocate space for compat store");
|
||||
errexit("cannot allocate space for compat store");
|
||||
memmove(*fssave, fs, sizeof(struct fs));
|
||||
|
||||
if (debug)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.36 2007/07/16 17:06:52 pooka Exp $ */
|
||||
/* $NetBSD: main.c,v 1.37 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -50,8 +50,9 @@
|
|||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
int returntosingle;
|
||||
int returntosingle = 0;
|
||||
|
||||
static int argtoi(int, const char *, const char *, int);
|
||||
static int checkfilesys(const char *, char *, long, int);
|
||||
|
@ -72,7 +73,7 @@ int
|
|||
main(int argc, char **argv)
|
||||
{
|
||||
int ch;
|
||||
int ret = 0;
|
||||
int ret = FSCK_EXIT_OK;
|
||||
const char *optstring = "b:dfi:m:npPqy";
|
||||
|
||||
skipclean = 1;
|
||||
|
@ -143,13 +144,13 @@ main(int argc, char **argv)
|
|||
if (preen)
|
||||
(void) signal(SIGQUIT, catchquit);
|
||||
|
||||
while (argc-- > 0)
|
||||
(void) checkfilesys(blockcheck(*argv++), 0, 0L, 0);
|
||||
while (argc-- > 0) {
|
||||
int nret = checkfilesys(blockcheck(*argv++), 0, 0L, 0);
|
||||
if (ret < nret)
|
||||
ret = nret;
|
||||
}
|
||||
|
||||
if (returntosingle)
|
||||
ret = 2;
|
||||
|
||||
exit(ret);
|
||||
return returntosingle ? FSCK_EXIT_UNRESOLVED : ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -160,7 +161,7 @@ argtoi(int flag, const char *req, const char *str, int base)
|
|||
|
||||
ret = (int) strtol(str, &cp, base);
|
||||
if (cp == str || *cp)
|
||||
err(1, "-%c flag requires a %s\n", flag, req);
|
||||
err(FSCK_EXIT_USAGE, "-%c flag requires a %s\n", flag, req);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -185,7 +186,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
if (preen)
|
||||
pfatal("CAN'T CHECK FILE SYSTEM.");
|
||||
case -1:
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -287,7 +288,7 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
free(statemap);
|
||||
free((char *)lncntp);
|
||||
if (!fsmodified) {
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
if (!preen)
|
||||
printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
|
||||
|
@ -302,23 +303,21 @@ checkfilesys(const char *filesys, char *mntpt, long auxdata, int child)
|
|||
if (statvfs("/", &stfs_buf) == 0) {
|
||||
long flags = stfs_buf.f_flag;
|
||||
struct ufs_args args;
|
||||
int ret;
|
||||
|
||||
if (flags & MNT_RDONLY) {
|
||||
args.fspec = 0;
|
||||
flags |= MNT_UPDATE | MNT_RELOAD;
|
||||
ret = mount(MOUNT_LFS, "/", flags,
|
||||
&args, sizeof args);
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
if (mount(MOUNT_LFS, "/", flags,
|
||||
&args, sizeof args) == 0)
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
}
|
||||
if (!preen)
|
||||
printf("\n***** REBOOT NOW *****\n");
|
||||
sync();
|
||||
return (4);
|
||||
return FSCK_EXIT_ROOT_CHANGED;
|
||||
}
|
||||
return (0);
|
||||
return FSCK_EXIT_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -326,7 +325,7 @@ usage(void)
|
|||
{
|
||||
|
||||
(void) fprintf(stderr,
|
||||
"usage: %s [-dfpq] [-b block] [-m mode] [-y | -n] filesystem ...\n",
|
||||
"Usage: %s [-dfpq] [-b block] [-m mode] [-y | -n] filesystem ...\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
exit(FSCK_EXIT_USAGE);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: utilities.c,v 1.26 2006/11/09 19:36:36 christos Exp $ */
|
||||
/* $NetBSD: utilities.c,v 1.27 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
|
@ -56,6 +56,7 @@
|
|||
#include "fsutil.h"
|
||||
#include "fsck.h"
|
||||
#include "extern.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
long diskreads, totalreads; /* Disk cache statistics */
|
||||
|
||||
|
@ -245,7 +246,7 @@ void
|
|||
catch(int n)
|
||||
{
|
||||
ckfini(0);
|
||||
exit(12);
|
||||
exit(FSCK_EXIT_SIGNALLED);
|
||||
}
|
||||
/*
|
||||
* When preening, allow a single quit to signal
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: check.c,v 1.15 2007/03/10 00:30:36 hubertf Exp $ */
|
||||
/* $NetBSD: check.c,v 1.16 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: check.c,v 1.15 2007/03/10 00:30:36 hubertf Exp $");
|
||||
__RCSID("$NetBSD: check.c,v 1.16 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -46,6 +46,7 @@ __RCSID("$NetBSD: check.c,v 1.15 2007/03/10 00:30:36 hubertf Exp $");
|
|||
|
||||
#include "ext.h"
|
||||
#include "fsutil.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
int
|
||||
checkfilesys(const char *filename)
|
||||
|
@ -55,7 +56,7 @@ checkfilesys(const char *filename)
|
|||
struct fatEntry *fat = NULL;
|
||||
int i, finish_dosdirsection=0;
|
||||
int mod = 0;
|
||||
int ret = 8;
|
||||
int ret = FSCK_EXIT_CHECK_FAILED;
|
||||
|
||||
rdonly = alwaysno;
|
||||
if (!preen)
|
||||
|
@ -74,13 +75,13 @@ checkfilesys(const char *filename)
|
|||
|
||||
if (dosfs < 0) {
|
||||
perr("Can't open `%s'", filename);
|
||||
return 8;
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
|
||||
if (readboot(dosfs, &boot) != FSOK) {
|
||||
close(dosfs);
|
||||
printf("\n");
|
||||
return 8;
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
|
||||
if (!preen) {
|
||||
|
@ -93,7 +94,7 @@ checkfilesys(const char *filename)
|
|||
mod |= readfat(dosfs, &boot, boot.ValidFat >= 0 ? boot.ValidFat : 0, &fat);
|
||||
if (mod & FSFATAL) {
|
||||
close(dosfs);
|
||||
return 8;
|
||||
return FSCK_EXIT_CHECK_FAILED;
|
||||
}
|
||||
|
||||
if (boot.ValidFat < 0)
|
||||
|
@ -177,7 +178,7 @@ checkfilesys(const char *filename)
|
|||
if (mod & (FSFATAL | FSERROR))
|
||||
goto out;
|
||||
|
||||
ret = 0;
|
||||
ret = FSCK_EXIT_OK;
|
||||
|
||||
out:
|
||||
if (finish_dosdirsection)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.18 2007/03/10 00:30:36 hubertf Exp $ */
|
||||
/* $NetBSD: main.c,v 1.19 2008/02/23 21:41:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995 Wolfgang Solfrank
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: main.c,v 1.18 2007/03/10 00:30:36 hubertf Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.19 2008/02/23 21:41:48 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -47,24 +47,27 @@ __RCSID("$NetBSD: main.c,v 1.18 2007/03/10 00:30:36 hubertf Exp $");
|
|||
|
||||
#include "fsutil.h"
|
||||
#include "ext.h"
|
||||
#include "exitvalues.h"
|
||||
|
||||
int alwaysno; /* assume "no" for all questions */
|
||||
int alwaysyes; /* assume "yes" for all questions */
|
||||
int preen; /* set when preening */
|
||||
int rdonly; /* device is opened read only (supersedes above) */
|
||||
|
||||
static void usage(void);
|
||||
static void usage(void) __dead;
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
errexit("usage: fsck_msdos [-fnpy] filesystem ... \n");
|
||||
(void)fprintf(stderr, "Usage: %s [-fnpy] filesystem ... \n",
|
||||
getprogname());
|
||||
exit(FSCK_EXIT_USAGE);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ret = 0, erg;
|
||||
int ret = FSCK_EXIT_OK, erg;
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "pPqynf")) != -1) {
|
||||
|
|
Loading…
Reference in New Issue