summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorSherry Moore <Sherry.Moore@Sun.COM>2009-11-05 11:15:08 -0800
committerSherry Moore <Sherry.Moore@Sun.COM>2009-11-05 11:15:08 -0800
commit3b860eee0637bb9a32dac1d3c9abccfa80570bbc (patch)
tree1c002347daf0b8c0315c8393920734711f5b7162 /usr/src
parentad601a0502a167436cd68b185fff0eb78c34777b (diff)
downloadillumos-gate-3b860eee0637bb9a32dac1d3c9abccfa80570bbc.tar.gz
6893906 an invalid reboot_transient option gets added on the grub menu on osol_1002-125
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/halt/halt.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c
index 869e399cab..ec7f7afdf4 100644
--- a/usr/src/cmd/halt/halt.c
+++ b/usr/src/cmd/halt/halt.c
@@ -380,6 +380,7 @@ continue_delegates()
}
#define FMRI_GDM "svc:/application/graphical-login/gdm:default"
+#define GDM_STOP_TIMEOUT 10 /* Give gdm 10 seconds to shut down */
/*
* If gdm is running, try to stop gdm.
@@ -395,8 +396,16 @@ stop_gdm()
* If gdm is running, try to stop gdm.
*/
while ((gdm_state = smf_get_state(FMRI_GDM)) != NULL &&
- strcmp(gdm_state, SCF_STATE_STRING_ONLINE) == 0 && retry++ < 5) {
- if (smf_disable_instance(FMRI_GDM, SMF_TEMPORARY) != 0) {
+ strcmp(gdm_state, SCF_STATE_STRING_ONLINE) == 0 &&
+ retry++ < GDM_STOP_TIMEOUT) {
+
+ free(gdm_state);
+
+ /*
+ * Only need to disable once.
+ */
+ if (retry == 1 &&
+ smf_disable_instance(FMRI_GDM, SMF_TEMPORARY) != 0) {
(void) fprintf(stderr,
gettext("%s: Failed to stop %s: %s.\n"),
cmdname, FMRI_GDM, scf_strerror(scf_error()));
@@ -405,7 +414,7 @@ stop_gdm()
(void) sleep(1);
}
- if (retry >= 5) {
+ if (retry >= GDM_STOP_TIMEOUT) {
(void) fprintf(stderr, gettext("%s: Failed to stop %s.\n"),
cmdname, FMRI_GDM);
return (-1);
@@ -1250,6 +1259,7 @@ main(int argc, char *argv[])
zoneid_t zoneid = getzoneid();
int need_check_zones = 0;
char bootargs_buf[BOOTARGS_MAX];
+ char *bootargs_orig = NULL;
char *bename = NULL;
const char * const resetting = "/etc/svc/volatile/resetting";
@@ -1350,6 +1360,7 @@ main(int argc, char *argv[])
return (1);
}
+ bootargs_orig = strdup(bootargs_buf);
mdep = (uintptr_t)bootargs_buf;
} else {
/*
@@ -1536,6 +1547,9 @@ main(int argc, char *argv[])
(void) fprintf(stderr,
gettext("%s: Falling back to regular reboot.\n"), cmdname);
fast_reboot = 0;
+ mdep = (uintptr_t)bootargs_orig;
+ } else if (bootargs_orig) {
+ free(bootargs_orig);
}
if (cmd != A_DUMP) {