From f30e021350fc8932d9baa9b5bc475517c42d2807 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org>
Date: Sun, 29 Aug 2010 18:41:13 +0000
Subject: - add a check for FWRITE here too.

ok miod@
---
 sys/dev/acpi/acpi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'sys/dev/acpi')

diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index ec0da75ec8c..43b482aff85 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.210 2010/08/27 20:31:55 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.211 2010/08/29 18:41:12 jasper Exp $ */
 /*
  * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
  * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2406,8 +2406,12 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
 	switch (cmd) {
 	case APM_IOC_SUSPEND:
 	case APM_IOC_STANDBY:
-		sc->sc_sleepmode = ACPI_STATE_S3;
-		acpi_wakeup(sc);
+		if ((flag & FWRITE) == 0) {
+			error = EBADF;
+		} else {
+			sc->sc_sleepmode = ACPI_STATE_S3;
+			acpi_wakeup(sc);
+		}
 		break;
 	case APM_IOC_GETPOWER:
 		/* A/C */
-- 
cgit v1.2.3