From 228bbc181cefc1f36d72c2b52dec55b3665a14cd Mon Sep 17 00:00:00 2001 From: davidn Date: Mon, 18 Aug 1997 01:40:12 +0000 Subject: Test that rc.shutdown exists before attempting to run it - silently return success if it doesn't to prevent any unwanted error msgs. --- sbin/init/init.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sbin/init/init.c') diff --git a/sbin/init/init.c b/sbin/init/init.c index 2070ed3..6411a3f 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: init.c,v 1.25 1997/08/06 16:07:52 ache Exp $ + * $Id: init.c,v 1.26 1997/08/06 16:34:51 ache Exp $ */ #ifndef lint @@ -51,6 +51,8 @@ static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 7/15/93"; #include #include #include +#include +#include #include #include @@ -1447,6 +1449,16 @@ runshutdown() size_t len; char *argv[3]; struct sigaction sa; + struct stat sb; + + /* + * rc.shutdown is optional, so to prevent any unnecessary + * complaints from the shell we simply don't run it if the + * file does not exist. If the stat() here fails for other + * reasons, we'll let the shell complain. + */ + if (stat(_PATH_RUNDOWN, &sb) == -1 && errno == ENOENT) + return 0; if ((pid = fork()) == 0) { int fd; -- cgit v1.1