summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-08-20 21:57:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-08-20 21:57:57 +0000
commit558e61ce6ab7c1f6d81aaaf5516cb61164ad3b73 (patch)
tree68aba9c30934183e4414699ee6a08234d52bf65e /sbin
parent3f911a3d005ea3d7df897f81c411539c8dd0fcce (diff)
clean some more signal races, some cannot be fixed
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_ffs/main.c10
-rw-r--r--sbin/fsck_ffs/utilities.c13
2 files changed, 14 insertions, 9 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 4d0f3f42727..bd9d210cb35 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.22 2002/06/09 08:13:05 todd Exp $ */
+/* $OpenBSD: main.c,v 1.23 2002/08/20 21:57:56 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.22 2002/06/09 08:13:05 todd Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.23 2002/08/20 21:57:56 deraadt Exp $";
#endif
#endif /* not lint */
@@ -64,7 +64,8 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.22 2002/06/09 08:13:05 todd Exp $";
#include "extern.h"
#include "fsutil.h"
-int returntosingle;
+volatile sig_atomic_t returntosingle;
+
int argtoi(int, char *, char *, int);
int checkfilesys(char *, char *, long, int);
int docheck(struct fstab *);
@@ -317,8 +318,11 @@ checkfilesys(filesys, mntpt, auxdata, child)
resolved = 0;
ckfini(resolved); /* Don't mark fs clean if fsck needs to be re-run */
free(blockmap);
+ blockmap = NULL;
free(statemap);
+ statemap = NULL;
free((char *)lncntp);
+ lncntp = NULL;
if (!fsmodified)
return (0);
if (!preen)
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c
index 2ed0fbbd5fe..f3dcf5cec57 100644
--- a/sbin/fsck_ffs/utilities.c
+++ b/sbin/fsck_ffs/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.15 2002/02/23 21:23:46 deraadt Exp $ */
+/* $OpenBSD: utilities.c,v 1.16 2002/08/20 21:57:56 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: utilities.c,v 1.15 2002/02/23 21:23:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: utilities.c,v 1.16 2002/08/20 21:57:56 deraadt Exp $";
#endif
#endif /* not lint */
@@ -514,10 +514,12 @@ void
catchquit(n)
int n;
{
- extern int returntosingle;
+ extern volatile sig_atomic_t returntosingle;
+ char buf[1024];
- /* XXX signal race */
- printf("returning to single-user after filesystem check\n");
+ snprintf(buf, sizeof buf,
+ "returning to single-user after filesystem check\n");
+ write(STDOUT_FILENO, buf, strlen(buf));
returntosingle = 1;
(void)signal(SIGQUIT, SIG_DFL);
}
@@ -531,7 +533,6 @@ voidquit(n)
int n;
{
- /* XXX signal race */
sleep(1);
(void)signal(SIGQUIT, SIG_IGN);
(void)signal(SIGQUIT, SIG_DFL);