From 9b8239809b2b46fac393b2a52de976e3eef3fa31 Mon Sep 17 00:00:00 2001 From: dsl Date: Tue, 5 Aug 2003 09:31:48 +0000 Subject: [PATCH] Exit child process if we fail to 'cd /dev' or 'execl sh MAKEDEV'. Don't really want two processes in the rest of init! --- sbin/init/init.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sbin/init/init.c b/sbin/init/init.c index 9571527c7636..5b686c599d7b 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.59 2003/07/12 14:46:41 itojun Exp $ */ +/* $NetBSD: init.c,v 1.60 2003/08/05 09:31:48 dsl Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n" #if 0 static char sccsid[] = "@(#)init.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: init.c,v 1.59 2003/07/12 14:46:41 itojun Exp $"); +__RCSID("$NetBSD: init.c,v 1.60 2003/08/05 09:31:48 dsl Exp $"); #endif #endif /* not lint */ @@ -1446,26 +1446,24 @@ mfs_dev(void) /* Run the makedev script to create devices */ switch ((pid = fork())) { case 0: - if (chdir("/dev") == -1) - goto fail; - (void)execl(INIT_BSHELL, "sh", "./MAKEDEV", "init", NULL); - goto fail; + if (chdir("/dev") == 0) + (void)execl(INIT_BSHELL, "sh", "./MAKEDEV", "init", + NULL); + _exit(1); case -1: - goto fail; + break; default: if (waitpid(pid, &status, 0) == -1) - goto fail; + break; if (status != 0) { errno = EINVAL; - goto fail; + break; } - break; + return 0; } - return(0); -fail: warn("Unable to run MAKEDEV"); - return(-1); + return (-1); } #endif