summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1998-09-28 05:13:14 +0000
committerJason Downs <downsj@cvs.openbsd.org>1998-09-28 05:13:14 +0000
commit29cba08d4c89cdc3caea4dd03cc150e6c0d272ec (patch)
tree4f349e6c3b807c8ff30e2f6919fb1715b00655b2 /sys/arch
parenta1c1e509fe0e2728266ed1c144e4cd7ef1f4bf89 (diff)
Avoid a really stupid APM-related panic.
Someone who knows about this crap should figure out why calling apm_set_powstate() after it's already failed once causes a vm_fault() crash.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/machdep.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 36adbde349f..ce0ca0ecc72 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.93 1998/08/30 07:30:13 downsj Exp $ */
+/* $OpenBSD: machdep.c,v 1.94 1998/09/28 05:13:13 downsj Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1230,11 +1230,17 @@ haltsys:
* Turn off, if we can. But try to turn disk off and
* wait a bit first--some disk drives are slow to
* clean up and users have reported disk corruption.
+ *
+ * If apm_set_powstate() fails the first time, don't
+ * try to turn the system off.
*/
delay(500000);
- apm_set_powstate(APM_DEV_DISK(0xff), APM_SYS_OFF);
- delay(500000);
- apm_set_powstate(APM_DEV_ALLDEVS, APM_SYS_OFF);
+ if (apm_set_powstate(APM_DEV_DISK(0xff),
+ APM_SYS_OFF) == 0) {
+ delay(500000);
+ (void) apm_set_powstate(APM_DEV_ALLDEVS,
+ APM_SYS_OFF);
+ }
}
#endif
printf("\n");