summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2021-03-26 22:55:49 +0000
committerkn <kn@cvs.openbsd.org>2021-03-26 22:55:49 +0000
commit04245959daf51d6eb67fe0432e7ca23645de9948 (patch)
treeaebcfd214616606e7211c7e1bc0bdac7f5fc4d36 /sys
parentf3d4b955daad15bf7a4742ca9485fba412522524 (diff)
Fix errno, merge ioctl cases
The EBADF error is always overwritten for the standby, suspend and hibernate ioctls, only the mode ioctl has it right. Merge the now identical casese while here. OK patrick
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/dev/apm.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/arch/arm64/dev/apm.c b/sys/arch/arm64/dev/apm.c
index f7072611cc3..cc7e3ccb78b 100644
--- a/sys/arch/arm64/dev/apm.c
+++ b/sys/arch/arm64/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.6 2020/12/25 12:59:51 visa Exp $ */
+/* $OpenBSD: apm.c,v 1.7 2021/03/26 22:55:48 kn Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -213,17 +213,15 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case APM_IOC_STANDBY_REQ:
case APM_IOC_SUSPEND:
case APM_IOC_SUSPEND_REQ:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- error = EOPNOTSUPP;
- break;
#ifdef HIBERNATE
case APM_IOC_HIBERNATE:
+#endif
+ case APM_IOC_DEV_CTL:
if ((flag & FWRITE) == 0)
error = EBADF;
- error = EOPNOTSUPP;
+ else
+ error = EOPNOTSUPP; /* XXX */
break;
-#endif
case APM_IOC_PRN_CTL:
if ((flag & FWRITE) == 0)
error = EBADF;
@@ -248,12 +246,6 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
}
break;
- case APM_IOC_DEV_CTL:
- if ((flag & FWRITE) == 0)
- error = EBADF;
- else
- error = EOPNOTSUPP; /* XXX */
- break;
case APM_IOC_GETPOWER:
power = (struct apm_power_info *)data;
error = (*get_apminfo)(power);