aboutsummaryrefslogtreecommitdiff
path: root/sbin/init
diff options
context:
space:
mode:
authorDavid Nugent <davidn@FreeBSD.org>1997-08-18 01:40:12 +0000
committerDavid Nugent <davidn@FreeBSD.org>1997-08-18 01:40:12 +0000
commit86bf62dc4aa885a6a7c7b38ed335354c7614fd85 (patch)
treee338a8592e078bca24ffe31075678af092c8c55a /sbin/init
parentff36905c57375bd7d1f306c65ccb037c5b6c60ff (diff)
downloadsrc-86bf62dc4aa885a6a7c7b38ed335354c7614fd85.tar.gz
src-86bf62dc4aa885a6a7c7b38ed335354c7614fd85.zip
Test that rc.shutdown exists before attempting to run it - silently
return success if it doesn't to prevent any unwanted error msgs.
Notes
Notes: svn path=/head/; revision=28344
Diffstat (limited to 'sbin/init')
-rw-r--r--sbin/init/init.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 2070ed3e2c39..6411a3fcd082 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 <sys/mount.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <db.h>
#include <errno.h>
@@ -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;