Catch signals and exit with the proper error code like all the other fsck

programs.
This commit is contained in:
christos 2008-02-24 00:59:03 +00:00
parent baa9962260
commit 358764c860
1 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.19 2008/02/23 21:41:48 christos Exp $ */
/* $NetBSD: main.c,v 1.20 2008/02/24 00:59:03 christos Exp $ */
/*
* Copyright (C) 1995 Wolfgang Solfrank
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: main.c,v 1.19 2008/02/23 21:41:48 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.20 2008/02/24 00:59:03 christos Exp $");
#endif /* not lint */
#include <stdlib.h>
@ -44,6 +44,7 @@ __RCSID("$NetBSD: main.c,v 1.19 2008/02/23 21:41:48 christos Exp $");
#include <unistd.h>
#include <errno.h>
#include <stdarg.h>
#include <signal.h>
#include "fsutil.h"
#include "ext.h"
@ -64,6 +65,12 @@ usage(void)
exit(FSCK_EXIT_USAGE);
}
static void
catch(int n)
{
exit(FSCK_EXIT_SIGNALLED);
}
int
main(int argc, char **argv)
{
@ -109,6 +116,11 @@ main(int argc, char **argv)
if (!argc)
usage();
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
(void) signal(SIGINT, catch);
if (preen)
(void) signal(SIGQUIT, catch);
while (--argc >= 0) {
setcdevname(*argv, preen);
erg = checkfilesys(*argv++);