changeset 2706:e78f8d1a9627

6462462 pool_set_status() must set the pool error code if the pool service enable/disable fails
author garypen
date Mon, 11 Sep 2006 05:47:34 -0700
parents a88063d9a249
children c58c084f09a5
files usr/src/lib/libpool/common/pool.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libpool/common/pool.c	Mon Sep 11 05:26:51 2006 -0700
+++ b/usr/src/lib/libpool/common/pool.c	Mon Sep 11 05:47:34 2006 -0700
@@ -734,18 +734,18 @@
 		 */
 		if (getenv("SMF_FMRI") == NULL) {
 			FILE *p;
+			char *cmd;
+
 			if (state) {
-				char *cmd = "/usr/sbin/svcadm enable -s " \
+				cmd = "/usr/sbin/svcadm enable -s " \
 				    SMF_SVC_INSTANCE;
-				if ((p = popen(cmd, "wF")) == NULL ||
-				    pclose(p) != 0)
-					return (PO_FAIL);
 			} else {
-				char *cmd = "/usr/sbin/svcadm disable -s " \
+				cmd = "/usr/sbin/svcadm disable -s " \
 				    SMF_SVC_INSTANCE;
-				if ((p = popen(cmd, "wF")) == NULL ||
-				    pclose(p) != 0)
-					return (PO_FAIL);
+			}
+			if ((p = popen(cmd, "wF")) == NULL || pclose(p) != 0) {
+				pool_seterror(POE_SYSTEM);
+				return (PO_FAIL);
 			}
 			return (PO_SUCCESS);
 		}