summaryrefslogtreecommitdiff
path: root/components/battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/battery.c')
-rw-r--r--components/battery.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/components/battery.c b/components/battery.c
index 49f43e6..807a7e6 100644
--- a/components/battery.c
+++ b/components/battery.c
@@ -59,13 +59,12 @@
fd = open("/dev/apm", O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "open '/dev/apm': %s\n", strerror(errno));
+ warn("open '/dev/apm':");
return NULL;
}
if (ioctl(fd, APM_IOC_GETPOWER, &apm_info) < 0) {
- fprintf(stderr, "ioctl 'APM_IOC_GETPOWER': %s\n",
- strerror(errno));
+ warn("ioctl 'APM_IOC_GETPOWER':");
close(fd);
return NULL;
}
@@ -90,13 +89,12 @@
fd = open("/dev/apm", O_RDONLY);
if (fd < 0) {
- fprintf(stderr, "open '/dev/apm': %s\n", strerror(errno));
+ warn("open '/dev/apm':");
return NULL;
}
if (ioctl(fd, APM_IOC_GETPOWER, &apm_info) < 0) {
- fprintf(stderr, "ioctl 'APM_IOC_GETPOWER': %s\n",
- strerror(errno));
+ warn("ioctl 'APM_IOC_GETPOWER':");
close(fd);
return NULL;
}