summaryrefslogtreecommitdiff
path: root/usr/src/cmd/halt
diff options
context:
space:
mode:
authorEnrico Perla - Sun Microsystems <Enrico.Perla@Sun.COM>2008-11-21 14:06:11 -0800
committerEnrico Perla - Sun Microsystems <Enrico.Perla@Sun.COM>2008-11-21 14:06:11 -0800
commit3a0fa635e8519965a7acdaf4d6645dfb14835a53 (patch)
treecd291e15593499b1c1c66d364c207388efbc6bd4 /usr/src/cmd/halt
parentae4caef845148f81ab1dd46f11a76c2b59e2353d (diff)
downloadillumos-joyent-3a0fa635e8519965a7acdaf4d6645dfb14835a53.tar.gz
6760271 reboot + ^c leaves the system inconsistent on X86
Diffstat (limited to 'usr/src/cmd/halt')
-rw-r--r--usr/src/cmd/halt/halt.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c
index 2bcb67cf46..bff08a65e5 100644
--- a/usr/src/cmd/halt/halt.c
+++ b/usr/src/cmd/halt/halt.c
@@ -76,6 +76,7 @@
#include <utmpx.h>
#include <pwd.h>
#include <zone.h>
+#include <spawn.h>
#include <libzfs.h>
@@ -1365,13 +1366,26 @@ main(int argc, char *argv[])
need_check_zones = halt_zones();
}
-
/* sync boot archive in the global zone */
if (zoneid == GLOBAL_ZONEID && !nosync) {
+ char *fast_argv[] = {"/sbin/bootadm", "-a", "update_all",
+ "fastboot", NULL};
+ char *b_argv[] = {"/sbin/bootadm", "-a", "update_all", NULL};
+
if (fast_reboot)
- (void) system("/sbin/bootadm -a update_all fastboot");
+ r = posix_spawn(NULL, fast_argv[0], NULL, NULL,
+ fast_argv, NULL);
+ else
+ r = posix_spawn(NULL, b_argv[0], NULL, NULL, b_argv,
+ NULL);
+
+ /* if posix_spawn fails we emit a warning and continue rebooting */
+
+ if (r != 0)
+ (void) fprintf(stderr, gettext("%s: WARNING, unable to"
+ "start boot archive update\n"), cmdname);
else
- (void) system("/sbin/bootadm -a update_all");
+ (void) wait(NULL);
}
/*
@@ -1430,6 +1444,8 @@ main(int argc, char *argv[])
(void) sleep(5);
}
+ (void) signal(SIGINT, SIG_IGN);
+
if (!qflag && !nosync) {
struct utmpx wtmpx;