[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Here is a bugfix for xbatt



My BIOS reports that the battery is greater than 100% charged.
This causes an array-out-of-bounds core dump.  The attached patch
simply tests for >= 100 rather than == 100 percent charge.


If there is a better way to report this bug, please let me know.

Thank you.

    - Don
*** xbatt-1.2.1.orig/xbatt.c	Mon Jul 28 10:15:47 2008
--- xbatt-1.2.1/xbatt.c	Mon Jul 28 10:16:07 2008
***************
*** 523,529 ****
                                    DefaultScreen(XtDisplay(toplevel))));
  	XFillRectangle(XtDisplay(toplevel), xpmData, gc, 18, 18, 13, 7);
  
! 	if (s.remain == 100) {
  	    bm = XCreatePixmapFromBitmapData(XtDisplay(toplevel),
  					     XtWindow(toplevel),
  					     full_bits, full_width,
--- 523,529 ----
                                    DefaultScreen(XtDisplay(toplevel))));
  	XFillRectangle(XtDisplay(toplevel), xpmData, gc, 18, 18, 13, 7);
  
! 	if (s.remain >= 100) {
  	    bm = XCreatePixmapFromBitmapData(XtDisplay(toplevel),
  					     XtWindow(toplevel),
  					     full_bits, full_width,

Attachment: signature.asc
Description: Digital signature


Reply to: