1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

fix error reporting for battery_* variables

* reproduce with a config displaying stuff for BAT0 and BAT1
  while only BAT0 is installed: the call to get_battery_stuff()
  for the existent BAT0 will reset the static variable rep and
  the errors for BAT1 will be reported over and over again
* this fix is not perfect: if both batteries are missing, only
  the first errors will be reported; but better than flooding the
  terminal


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1243 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Phil 2008-09-01 23:46:48 +00:00
parent 3adb16ea40
commit 56ba0250ab

View File

@ -1582,7 +1582,7 @@ void set_return_value(char *buffer, unsigned int n, int item, int idx);
void get_battery_stuff(char *buffer, unsigned int n, const char *bat, int item)
{
static int idx, rep = 0, rep2 = 0;
static int idx, rep = 0, rep1 = 0, rep2 = 0;
char acpi_path[128];
char sysfs_path[128];
@ -1608,11 +1608,10 @@ void get_battery_stuff(char *buffer, unsigned int n, const char *bat, int item)
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
sysfs_bat_fp[idx] = open_file(sysfs_path, &rep);
rep = 0;
}
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
acpi_bat_fp[idx] = open_file(acpi_path, &rep);
acpi_bat_fp[idx] = open_file(acpi_path, &rep1);
}
if (sysfs_bat_fp[idx] != NULL) {