Mercurial > illumos > illumos-gate
changeset 10964:70ffca3020b2
6893906 an invalid reboot_transient option gets added on the grub menu on osol_1002-125
author | Sherry Moore <Sherry.Moore@Sun.COM> |
---|---|
date | Thu, 05 Nov 2009 11:15:08 -0800 |
parents | 0984a1a1a377 |
children | 6172c8d12ec5 |
files | usr/src/cmd/halt/halt.c |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/halt/halt.c Thu Nov 05 10:16:30 2009 -0800 +++ b/usr/src/cmd/halt/halt.c Thu Nov 05 11:15:08 2009 -0800 @@ -380,6 +380,7 @@ } #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 @@ * 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 @@ (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 @@ 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 @@ return (1); } + bootargs_orig = strdup(bootargs_buf); mdep = (uintptr_t)bootargs_buf; } else { /* @@ -1536,6 +1547,9 @@ (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) {