changeset 13791:40cea5d62fa3

3121 missing SMF method directories should say something useful Reviewed by: Gary Mills <gary_mills@fastmail.fm> Reviewed by: T Nguyen <truongqnguien@gmail.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Approved by: Robert Mustacchi <rm@joyent.com>
author Hengqing Hu <hudayou@hotmail.com>
date Thu, 30 Aug 2012 13:37:54 +0000
parents ac6eff781c67
children 4be8368f41e4
files usr/src/cmd/svc/startd/method.c
diffstat 1 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/svc/startd/method.c	Thu Aug 30 05:13:49 2012 -0700
+++ b/usr/src/cmd/svc/startd/method.c	Thu Aug 30 13:37:54 2012 +0000
@@ -516,6 +516,33 @@
 			exit(SMF_EXIT_ERR_CONFIG);
 		}
 
+		if (errf != NULL && strcmp(errf, "chdir") == 0) {
+			switch (rsmc_errno) {
+			case EACCES:
+			case EFAULT:
+			case EIO:
+			case ELOOP:
+			case ENAMETOOLONG:
+			case ENOENT:
+			case ENOLINK:
+			case ENOTDIR:
+				log_instance(inst, B_FALSE, "%s: %s (\"%s\")",
+				    errf,
+				    strerror(rsmc_errno), mcp->working_dir);
+				break;
+
+			default:
+#ifndef NDEBUG
+				uu_warn("%s:%d: Bad error %d for function %s "
+				    "in restarter_set_method_context().\n",
+				    __FILE__, __LINE__, rsmc_errno, errf);
+#endif
+				abort();
+			}
+
+			exit(SMF_EXIT_ERR_CONFIG);
+		}
+
 		if (errf != NULL) {
 			errno = rsmc_errno;
 			perror(errf);