diff options
author | mrg <mrg> | 2003-11-10 23:53:32 +0000 |
---|---|---|
committer | mrg <mrg> | 2003-11-10 23:53:32 +0000 |
commit | 367d5e0ead7c8b841edcdf02fb5667747fa589fe (patch) | |
tree | 9a04b297aaa6f45b787ccf2eba2b0a9be8729ce6 /sysutils/xbattbar/patches | |
parent | 95982600e3c10ea92402e79b91c62a1d06c31b52 (diff) | |
download | pkgsrc-367d5e0ead7c8b841edcdf02fb5667747fa589fe.tar.gz |
rework the previous to not try to use _PATH_SYSMON if it isn't defined.
fixes PR#23355 finally.
Diffstat (limited to 'sysutils/xbattbar/patches')
-rw-r--r-- | sysutils/xbattbar/patches/patch-ab | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sysutils/xbattbar/patches/patch-ab b/sysutils/xbattbar/patches/patch-ab index 7ff04579586..32108a7cd55 100644 --- a/sysutils/xbattbar/patches/patch-ab +++ b/sysutils/xbattbar/patches/patch-ab @@ -1,7 +1,7 @@ -$NetBSD: patch-ab,v 1.5 2003/11/05 07:26:04 mrg Exp $ +$NetBSD: patch-ab,v 1.6 2003/11/10 23:53:32 mrg Exp $ --- xbattbar.c.orig 2001-02-02 16:25:29.000000000 +1100 -+++ xbattbar.c 2003-11-03 17:17:11.000000000 +1100 ++++ xbattbar.c 2003-11-10 17:50:08.000000000 +1100 @@ -27,6 +27,14 @@ #include <sys/types.h> @@ -17,7 +17,7 @@ $NetBSD: patch-ab,v 1.5 2003/11/05 07:26:04 mrg Exp $ #include <signal.h> #include <stdio.h> #include <unistd.h> -@@ -583,39 +590,171 @@ +@@ -583,39 +591,174 @@ #define _PATH_APM_CTLDEV "/dev/apmctl" #define _PATH_APM_NORMAL "/dev/apm" @@ -89,17 +89,22 @@ $NetBSD: patch-ab,v 1.5 2003/11/05 07:26:04 mrg Exp $ { int fd, r, p; struct apm_power_info info; +- +- if ((fd = open(_PATH_APM_NORMAL, O_RDONLY)) == -1) { +- fprintf(stderr, "xbattbar: cannot open apm device\n"); +- exit(1); + int acpi; + size_t ns; + size_t cc; ++ char *apmdev; + int i; - ++ + acpi = 0; - if ((fd = open(_PATH_APM_NORMAL, O_RDONLY)) == -1) { -- fprintf(stderr, "xbattbar: cannot open apm device\n"); -- exit(1); ++ apmdev = _PATH_APM_NORMAL; ++ if ((fd = open(apmdev, O_RDONLY)) == -1) { +#ifdef HAVE_NETBSD_ACPI -+ fd = open(_PATH_SYSMON, O_RDONLY); ++ apmdev = _PATH_SYSMON; ++ fd = open(apmdev, O_RDONLY); + acpi = 1; +#endif } @@ -107,7 +112,7 @@ $NetBSD: patch-ab,v 1.5 2003/11/05 07:26:04 mrg Exp $ - if (ioctl(fd, APM_IOC_GETPOWER, &info) != 0) { - fprintf(stderr, "xbattbar: ioctl APM_IOC_GETPOWER failed\n"); + if (fd < 0) { -+ fprintf(stderr, "xbattbar: cannot open %s device\n", (acpi) ? _PATH_SYSMON : _PATH_APM_NORMAL); ++ fprintf(stderr, "xbattbar: cannot open %s device\n", apmdev); exit(1); } |