From ad5536b59f3205ecb8c086eb7cfbcbebb277bfbe Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 19 Jul 2000 06:34:02 +0000 Subject: [PATCH] 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. --- usr.sbin/apm/apm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c index 89d3a50ce3a..e64dc7b5fd7 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)