summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2021-03-25 20:46:55 +0000
committerkn <kn@openbsd.org>2021-03-25 20:46:55 +0000
commit2f1f646e8757007fbc0460c681bd7006b60b9e86 (patch)
treeac3ea729e60743bdc7542f1e8962696fa06becee /usr.sbin
parentMove the expression list create item code into a single function. (diff)
downloadwireguard-openbsd-2f1f646e8757007fbc0460c681bd7006b60b9e86.tar.xz
wireguard-openbsd-2f1f646e8757007fbc0460c681bd7006b60b9e86.zip
Log ioctl failures
Otherwise there is no way to determine why e.g. zzz(8) does not do anything on certain machines; macppc and arm64 for example have no suspend/resume suspend at all (for now) and loongson has partial support. This still does not make `zzz' or `apm -z' report the informative warning on standar error, but syslog now prints apmd: system suspending apmd: battery status: unknown. external power status: not known. estimated battery life 0% apmd: suspend: Operation not supported OK benno
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/apmd/apmd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 8e487963d27..58026f7a72b 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.101 2021/03/16 09:00:43 kn Exp $ */
+/* $OpenBSD: apmd.c,v 1.102 2021/03/25 20:46:55 kn Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -329,7 +329,8 @@ suspend(int ctl_fd)
do_etc_file(_PATH_APM_ETC_SUSPEND);
sync();
sleep(1);
- ioctl(ctl_fd, APM_IOC_SUSPEND, 0);
+ if (ioctl(ctl_fd, APM_IOC_SUSPEND, 0) == -1)
+ logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
}
void
@@ -340,7 +341,8 @@ stand_by(int ctl_fd)
do_etc_file(_PATH_APM_ETC_STANDBY);
sync();
sleep(1);
- ioctl(ctl_fd, APM_IOC_STANDBY, 0);
+ if (ioctl(ctl_fd, APM_IOC_STANDBY, 0) == -1)
+ logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
}
void
@@ -351,7 +353,8 @@ hibernate(int ctl_fd)
do_etc_file(_PATH_APM_ETC_HIBERNATE);
sync();
sleep(1);
- ioctl(ctl_fd, APM_IOC_HIBERNATE, 0);
+ if (ioctl(ctl_fd, APM_IOC_HIBERNATE, 0) == -1)
+ logmsg(LOG_WARNING, "%s: %s", __func__, strerror(errno));
}
void