Hello Release Managers,

the 2.3.3-4 revision of cpufreqd fixes a grave bug (509355). 
In short cpufreqd was crashing on laptops with two (or more!) batteries.
One may argue that this is not really a grave bug, but anyway...

The change is non intrusive and trivial, this is the diff. Could you
please unblock cpufreqd-2.3.3-4 for lenny?

diff --git a/debian/changelog b/debian/changelog
index 92a6c41..aa00559 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+cpufreqd (2.3.3-4) unstable; urgency=low
+
+  * Fix segfaulting on laptops with more than one battery,
+    patch from Stefan Bühler (Closes: #509355).
+
+ -- Mattia Dongili <[email protected]>  Wed, 24 Dec 2008 22:01:17 +0900
+
 cpufreqd (2.3.3-3) unstable; urgency=low
 
   * backport a patch from upstream repository fixing
diff --git a/debian/patches/03_two_batteries_segfault_fix.patch 
b/debian/patches/03_two_batteries_segfault_fix.patch
new file mode 100644
index 0000000..d26199f
--- /dev/null
+++ b/debian/patches/03_two_batteries_segfault_fix.patch
@@ -0,0 +1,34 @@
+The problem is that check_timeout is reset after the first battery got
+updated, so the values for the second battery are never read.
+
+This results in status->value == NULL, and strncmp segfaults.
+
+The solution is to update check_timeout after all battery values are updated.
+
+kind regards
+Stefan
+
+---
+diff -r -u -b cpufreqd-2.3.3/src/cpufreqd_acpi_battery.c 
cpufreqd-2.3.3.new/src/cpufreqd_acpi_battery.c
+--- cpufreqd-2.3.3/src/cpufreqd_acpi_battery.c 2008-08-23 05:52:47.000000000 
+0200
++++ cpufreqd-2.3.3.new/src/cpufreqd_acpi_battery.c     2008-12-23 
19:39:18.850501003 +0100
+@@ -325,7 +325,6 @@
+ 
+               /* if check_timeout is expired */
+               if (check_timeout <= 0) {
+-                      check_timeout = acpi_config.battery_update_interval;
+                       if (read_battery(&info[i]) == 0)
+                               n_read++;
+                       else
+@@ -365,6 +364,11 @@
+ #endif
+       } /* end info loop */
+ 
++      /* check_timeout is global for all batteries, so update it after all 
batteries got updated */
++      if (check_timeout <= 0) {
++              check_timeout = acpi_config.battery_update_interval;
++      }
++
+       /* calculates medium battery life between all batteries */
+       if (total_capacity > 0)
+               avg_battery_level = 100 * (total_remaining / 
(double)total_capacity);
diff --git a/debian/patches/series b/debian/patches/series
index 84fa53f..50ecbba 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 01_acpitz_support.patch
 02_fix_segfault_reading_class_devices.patch
+03_two_batteries_segfault_fix.patch

thanks
-- 
mattia
:wq!


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to