pkgsrc/sysutils/xbatt/patches/patch-ab
hubertf 35041f8b1f Keep xbattbar from dumping core when the battery reports
>100% full. Patch submitted by kre@munnari.OZ.AU in PR 38148.
2008-03-06 17:24:23 +00:00

29 lines
795 B
Text

$NetBSD: patch-ab,v 1.3 2008/03/06 17:24:23 hubertf Exp $
--- xbatt.c.orig 1998-09-18 14:03:05.000000000 +0200
+++ xbatt.c
@@ -219,6 +219,7 @@ struct Digits digits[] = {
String fallback_resouces[] = {
"*width: 39",
"*height: 39",
+ NULL
};
main(
@@ -494,6 +495,7 @@ struct status getBatteryStatus()
#ifdef __NetBSD__
struct apm_power_info info;
+ memset(&info, 0, sizeof(info));
if( ioctl(apmfd, APM_IOC_GETPOWER, &info) == -1 ) {
fprintf(stderr, "xbatt: ioctl APM_IOC_GETPOWER failed\n");
exit(1);
@@ -686,7 +688,7 @@ void updateWindow(struct status s)
5, 5, 11, 7);
}
- if (s.remain == 100) {
+ if (s.remain >= 100) {
bm = XCreatePixmapFromBitmapData(XtDisplay(toplevel),
XtWindow(toplevel),
full_bits, full_width,