aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/apm
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2000-07-19 06:34:02 +0000
committerWarner Losh <imp@FreeBSD.org>2000-07-19 06:34:02 +0000
commitad5536b59f3205ecb8c086eb7cfbcbebb277bfbe (patch)
treef74bf3f28a506ac9cdca0455a4f48333a306257a /usr.sbin/apm
parent785c4f1a3dcaa8c831f8d5d19ae064a50fdab1bb (diff)
downloadsrc-ad5536b59f3205ecb8c086eb7cfbcbebb277bfbe.tar.gz
src-ad5536b59f3205ecb8c086eb7cfbcbebb277bfbe.zip
When we're just reading info from the driver, attempt to open the apm
device read only so we can suppot a readonly apm device.
Notes
Notes: svn path=/head/; revision=63495
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r--usr.sbin/apm/apm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index 89d3a50ce3a9..e64dc7b5fd72 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -412,7 +412,10 @@ main(int argc, char *argv[])
argv += optind;
}
finish_option:
- fd = open(APMDEV, O_RDWR);
+ if (haltcpu != -1 || enable != -1 || delta || sleep || standby)
+ fd = open(APMDEV, O_RDWR);
+ else
+ fd = open(APMDEV, O_RDONLY);
if (fd == -1)
err(1, "can't open %s", APMDEV);
if (enable != -1)