5004701 svc-savecore should be quieter about swap devices with no dump support
authoreschrock
Wed, 22 Feb 2006 18:19:30 -0800
changeset 1471 bc2f8287f52d
parent 1470 99cf32109429
child 1472 6d54521a5237
5004701 svc-savecore should be quieter about swap devices with no dump support
usr/src/cmd/dumpadm/svc-dumpadm
usr/src/cmd/savecore/savecore.c
--- a/usr/src/cmd/dumpadm/svc-dumpadm	Wed Feb 22 16:16:04 2006 -0800
+++ b/usr/src/cmd/dumpadm/svc-dumpadm	Wed Feb 22 18:19:30 2006 -0800
@@ -3,9 +3,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
 #
 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 # or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 #ident	"%Z%%M%	%I%	%E% SMI"
@@ -88,7 +87,8 @@
 # saved the dump, savecore will just exit immediately.
 #
 if [ "x$DUMPADM_ENABLE" != xno ]; then
-	if /usr/sbin/swap -l | grep "^${DUMPADM_DEVICE} " >/dev/null 2>&1; then
+	if /usr/sbin/swap -l 2>/dev/null | grep "^${DUMPADM_DEVICE} " \
+	    >/dev/null 2>&1; then
 		#
 		# If the dump device is part of swap, we only need to run
 		# savecore a second time if the device is different from the
--- a/usr/src/cmd/savecore/savecore.c	Wed Feb 22 16:16:04 2006 -0800
+++ b/usr/src/cmd/savecore/savecore.c	Wed Feb 22 18:19:30 2006 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 1998-2002 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -450,8 +449,18 @@
 
 	if (dumpfile == NULL) {
 		dumpfile = Zalloc(MAXPATHLEN);
-		if (ioctl(dumpfd, DIOCGETDEV, dumpfile) == -1)
-			logprint(LOG_ERR, 1, 1, "no dump device configured");
+		if (ioctl(dumpfd, DIOCGETDEV, dumpfile) == -1) {
+			/*
+			 * If this isn't an interactive session, we are running
+			 * as part of the boot process.  If this is the case,
+			 * don't complain about the lack of dump device.
+			 */
+			if (isatty(STDOUT_FILENO))
+				logprint(LOG_ERR, 1, 1,
+				    "no dump device configured");
+			else
+				return (1);
+		}
 	}
 
 	if (mflag)