Package: cpufreqd
Version: 2.4.2-1
Followup-For: Bug #619913

Hi,

just checked the attached patch which i've got from:

https://bugs.launchpad.net/ubuntu/+source/cpufreqd/+bug/733507/comments/7

and this fixes the glibc crash. Please review this fix.

Thanks

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (600, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to de_DE.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cpufreqd depends on:
ii  libc6        2.13-35
ii  libcpufreq0  008-1
ii  libsensors4  1:3.3.2-2
ii  libsysfs2    2.1.0+repack-1.2
ii  lsb-base     4.1+Debian8

Versions of packages cpufreqd recommends:
ii  acpid  1:2.0.16-1

Versions of packages cpufreqd suggests:
ii  cpufrequtils  008-1

-- Configuration Files:
/etc/cpufreqd.conf changed [not included]

-- no debconf information
--- src/cpufreqd_acpi_battery.c.orig	2010-04-18 15:57:41.000000000 +0200
+++ src/cpufreqd_acpi_battery.c	2012-04-07 14:26:54.409641936 +0200
@@ -36,6 +36,7 @@
 #define PRESENT		"present"
 #define STATUS		"status"
 #define CURRENT_NOW	"current_now"
+#define POWER_NOW	"power_now"
 
 struct battery_info {
 	int capacity;
@@ -146,8 +147,12 @@
 	if (!binfo->status)
 		return -1;
 	binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW);
-	if (!binfo->current_now)
-		return -1;
+	if (!binfo->current_now) {
+		/* try the "power_now" name */
+		binfo->current_now = get_class_device_attribute(binfo->cdev, POWER_NOW);
+		if (!binfo->current_now)
+			return -1;
+	}
 
 	/* read the last full capacity, this is not going to change
 	 * very often, so no need to poke it later */
@@ -311,6 +316,10 @@
 
 	/* Read battery informations */
 	for (i = 0; i < bat_dir_num; i++) {
+		if (!info[i].open) {
+			clog(LOG_INFO, "Skipping %s (closed)\n", info[i].cdev->name);
+			continue;
+		}
 
 		if (read_int(info[i].present, &info[i].is_present) != 0) {
 			clog(LOG_INFO, "Skipping %s\n", info[i].cdev->name);

Reply via email to