#include "nls.h"
#include "pathnames.h"
#include "ismounted.h"
+#include "exitcodes.h"
#include "c.h"
#include "fsck.h"
-#define XALLOC_EXIT_CODE EXIT_ERROR
+#define XALLOC_EXIT_CODE FSCK_EX_ERROR
#include "xalloc.h"
static const char *ignored_types[] = {
(void) execv(s, argv);
perror(argv[0]);
free(inst);
- exit(EXIT_ERROR);
+ exit(FSCK_EX_ERROR);
}
for (i=0; i < argc; i++)
else if (WIFSIGNALED(status)) {
sig = WTERMSIG(status);
if (sig == SIGINT) {
- status = EXIT_UNCORRECTED;
+ status = FSCK_EX_UNCORRECTED;
} else {
warnx(_("Warning... %s for device %s exited "
"with signal %d."),
inst->prog, inst->fs->device, sig);
- status = EXIT_ERROR;
+ status = FSCK_EX_ERROR;
}
} else {
warnx(_("%s %s: status is %x, should never happen."),
inst->prog, inst->fs->device, status);
- status = EXIT_ERROR;
+ status = FSCK_EX_ERROR;
}
inst->exit_status = status;
inst->flags |= FLAG_DONE;
if (fork() == 0) {
sleep(1);
kill(inst2->pid, SIGUSR1);
- exit(EXIT_OK);
+ exit(FSCK_EX_OK);
}
} else
kill(inst2->pid, SIGUSR1);
warnx(_("error %d while executing fsck.%s for %s"),
retval, type, fs->device);
num_running--;
- return EXIT_ERROR;
+ return FSCK_EX_ERROR;
}
return 0;
}
}
if ((negate && !cmp->negate) ||
(!negate && cmp->negate)) {
- errx(EXIT_USAGE,
+ errx(FSCK_EX_USAGE,
_("Either all or none of the filesystem types passed to -t must be prefixed\n"
"with 'no' or '!'."));
}
static int check_all(NOARGS)
{
struct fs_info *fs = NULL;
- int status = EXIT_OK;
+ int status = FSCK_EX_OK;
int not_done_yet = 1;
int passno = 1;
int pass_done;
!(ignore_mounted && is_mounted(fs->device))) {
status |= fsck_device(fs, 1);
status |= wait_many(FLAG_WAIT_ALL);
- if (status > EXIT_NONDESTRUCT)
+ if (status > FSCK_EX_NONDESTRUCT)
return status;
}
fs->flags |= FLAG_DONE;
" -? display this help and exit\n\n"
"See fsck.* commands for fs-options."));
- exit(EXIT_USAGE);
+ exit(FSCK_EX_USAGE);
}
static void signal_cancel(int sig FSCK_ATTR((unused)))
continue;
if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
if (num_devices >= MAX_DEVICES)
- errx(EXIT_ERROR, _("too many devices"));
+ errx(FSCK_EX_ERROR, _("too many devices"));
dev = fsprobe_get_devname_by_spec(arg);
if (!dev && strchr(arg, '=')) {
/*
if (access(_PATH_PROC_PARTITIONS, R_OK) < 0) {
warn(_("couldn't open %s"),
_PATH_PROC_PARTITIONS);
- errx(EXIT_ERROR, _("Is /proc mounted?"));
+ errx(FSCK_EX_ERROR, _("Is /proc mounted?"));
}
/*
* Check to see if this is because
* we're not running as root
*/
if (geteuid())
- errx(EXIT_ERROR,
+ errx(FSCK_EX_ERROR,
_("must be root to scan for matching filesystems: %s"),
arg);
else
- errx(EXIT_ERROR,
+ errx(FSCK_EX_ERROR,
_("couldn't find matching filesystem: %s"),
arg);
}
}
if (arg[0] != '-' || opts_for_fsck) {
if (num_args >= MAX_ARGS)
- errx(EXIT_ERROR, _("too many arguments"));
+ errx(FSCK_EX_ERROR, _("too many arguments"));
args[num_args++] = string_copy(arg);
continue;
}
options[0] = '-';
options[++opt] = '\0';
if (num_args >= MAX_ARGS)
- errx(EXIT_ERROR, _("too many arguments"));
+ errx(FSCK_EX_ERROR, _("too many arguments"));
args[num_args++] = string_copy(options);
opt = 0;
}