source: pkg/main/gnome-applets/trunk/debian/patches/60_acpi-info-missing.patch @ 1764

Revision 1764, 1.4 KB checked in by alanbach-guest, 6 years ago (diff)

gnome-applets, Sync'd with Debian

  • battstat/acpi-linux.c

    GNOME #427562; Debian #418992; fixes crash when /proc/acpi/info is missing,
    as will soon be the case with new kernels.
    
    diff -Nur gnome-applets-2.18.0/battstat/acpi-linux.c gnome-applets-2.18.0.new/battstat/acpi-linux.c
    old new  
    200200  acpiinfo->max_capacity = 0; 
    201201  acpiinfo->low_capacity = 0; 
    202202  acpiinfo->critical_capacity = 0; 
     203  acpiinfo->ac_state_state = "state"; 
     204  acpiinfo->batt_state_state = "state"; 
     205  acpiinfo->charging_state = "charging state"; 
    203206 
    204207  hash = read_file ("/proc/acpi/info", buf, sizeof (buf)); 
    205   if (!hash) 
    206     return FALSE; 
    207  
    208   acpi_ver = read_ulong (hash, "version"); 
    209   g_hash_table_destroy (hash); 
    210  
    211   if (acpi_ver < (gulong)20020208) { 
    212     acpiinfo->ac_state_state = "status"; 
    213     acpiinfo->batt_state_state = "status"; 
    214     acpiinfo->charging_state = "state"; 
    215   } else { 
    216     acpiinfo->ac_state_state = "state"; 
    217     acpiinfo->batt_state_state = "state"; 
    218     acpiinfo->charging_state = "charging state"; 
     208  if (hash) 
     209  { 
     210          acpi_ver = read_ulong (hash, "version"); 
     211          g_hash_table_destroy (hash); 
     212 
     213          if (acpi_ver < (gulong)20020208) { 
     214                  acpiinfo->ac_state_state = "status"; 
     215                  acpiinfo->batt_state_state = "status"; 
     216                  acpiinfo->charging_state = "state"; 
     217          } 
    219218  } 
    220219 
    221220  procdir=opendir("/proc/acpi/battery/"); 
Note: See TracBrowser for help on using the repository browser.