rev 4889 - in trunk/packages/kdeutils/debian: . patches

Josh Metzler jdmetz-guest at alioth.debian.org
Fri Nov 10 21:22:02 UTC 2006


Author: jdmetz-guest
Date: 2006-11-10 22:22:01 +0100 (Fri, 10 Nov 2006)
New Revision: 4889

Added:
   trunk/packages/kdeutils/debian/patches/15_klaptopdaemon_filenames_check.diff
Modified:
   trunk/packages/kdeutils/debian/changelog
Log:
Adapt and merge the two patches to klaptopdaemon from upstream bug 103437, debian bug 397098.  Keep .xssession-errors from filling up and the disk from being always busy from trying to open non-existent files.

Modified: trunk/packages/kdeutils/debian/changelog
===================================================================
--- trunk/packages/kdeutils/debian/changelog	2006-11-10 20:52:29 UTC (rev 4888)
+++ trunk/packages/kdeutils/debian/changelog	2006-11-10 21:22:01 UTC (rev 4889)
@@ -13,8 +13,12 @@
 
   * Adapt rewritten paragraph for kcharselect.1 manpage. (Closes: #314691)
 
- -- Josh Metzler <josh at metzlers.org>  Thu,  9 Nov 2006 22:26:18 -0500
+  * Add klaptopdaemon patch to check for empty filenames before trying to
+    open them so we don't fill .xsession-errors and keep the disk busy.
+    (Closes: #397098)
 
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Fri, 10 Nov 2006 16:16:50 -0500
+
 kdeutils (4:3.5.5-1) unstable; urgency=low
 
   * New upstream release.

Added: trunk/packages/kdeutils/debian/patches/15_klaptopdaemon_filenames_check.diff
===================================================================
--- trunk/packages/kdeutils/debian/patches/15_klaptopdaemon_filenames_check.diff	2006-11-10 20:52:29 UTC (rev 4888)
+++ trunk/packages/kdeutils/debian/patches/15_klaptopdaemon_filenames_check.diff	2006-11-10 21:22:01 UTC (rev 4889)
@@ -0,0 +1,187 @@
+--- a/klaptopdaemon/laptop_daemon.cpp	2006-01-19 11:49:18.000000000 -0500
++++ b/klaptopdaemon/laptop_daemon.cpp	2006-11-10 16:13:00.000000000 -0500
+@@ -955,7 +955,7 @@
+ 	// the lid button turns stuff on when it's down and back off again when it's raised
+ 	// 	(kind of like the fridge door light)
+ 	//
+-	if (lid_state != laptop_portable::get_button(laptop_portable::LidButton)) {
++	if (s.enable_lid_button && lid_state != laptop_portable::get_button(laptop_portable::LidButton)) {
+ 		lid_state = !lid_state;
+ 		if (lid_state) {
+ 			if (s.button_lid_bright_enabled) {
+@@ -1018,7 +1018,7 @@
+ 	//
+ 	// the power button on the other hand is an off/on switch for non-suspend type ops
+ 	//
+-	if (power_state != laptop_portable::get_button(laptop_portable::PowerButton)) {
++	if (s.enable_power_button && power_state != laptop_portable::get_button(laptop_portable::PowerButton)) {
+ 		power_state = !power_state;
+ 		if (power_state) {
+ 			if (power_button_off) {
+--- a/klaptopdaemon/portable.cpp	2006-05-22 14:08:33.000000000 -0400
++++ b/klaptopdaemon/portable.cpp	2006-11-10 16:11:11.000000000 -0500
+@@ -177,7 +177,7 @@
+ 	int bcnt = 0;
+ 	memset(ap, 0, sizeof(apm_info));
+ 	QFile f("/proc/pmu/info");
+-	if (!f.open(IO_ReadOnly))
++	if (!f.exists() || !f.open(IO_ReadOnly))
+ 		return 1;
+ 
+ 	while (!f.atEnd()) {
+@@ -200,7 +200,7 @@
+ 	int maxcharge = 0;
+ 	for (int i = 0; i < bcnt; i++) {
+ 		QFile bf(QString("/proc/pmu/battery_%1").arg(i));
+-		if (!bf.open(IO_ReadOnly))
++		if (!bf.exists() || !bf.open(IO_ReadOnly))
+ 			continue;
+ 
+ 		while(!bf.atEnd()) {
+@@ -331,7 +331,7 @@
+ 		bool present = false;
+ 		if ((test_count==0 || acpi_last_known != last_seed) && !bat.info_file.isNull()) {
+ 			f = new QFile(bat.info_file);
+-			if (f && f->open(IO_ReadOnly)) {
++			if (f && f->exists() && f->open(IO_ReadOnly)) {
+ 				while(f->readLine(buff,1024) > 0) {
+ 					if (buff.contains("design capacity low:", false)) {
+ 						QRegExp rx("(\\d*)\\D*$");
+@@ -361,7 +361,7 @@
+ 		}
+ 		if (!bat.state_file.isNull()) {
+ 			f = new QFile(bat.state_file);
+-			if (f && f->open(IO_ReadOnly)) {
++			if (f && f->exists() && f->open(IO_ReadOnly)) {
+ 				while(f->readLine(buff,1024) > 0) {
+ 					if (buff.contains("present rate:", false)) {
+ 						QRegExp rx("(\\d*)\\D*$");
+@@ -692,7 +692,7 @@
+ 		QFile p("/sys/power/state");
+ 		QFile f("/proc/acpi/sleep");
+ 
+-		if (p.open(IO_ReadOnly)) {
++		if (p.exists() && p.open(IO_ReadOnly)) {
+ 			QString l;
+ 			p.readLine(l,500);
+ 			QStringList ll = QStringList::split(' ',l,false);
+@@ -708,7 +708,7 @@
+ 			}
+ 			p.close();
+ 		}
+-		else if (f.open(IO_ReadOnly)) {
++		else if (f.exists() && f.open(IO_ReadOnly)) {
+ 			QString l;
+ 			f.readLine(l, 500);
+ 			QStringList ll = QStringList::split(' ',l,false);
+@@ -1254,7 +1254,7 @@
+ 	if (!lav_inited) {
+ 		lav_inited =1;
+ 		lav_file.setName("/proc/loadavg");
+-		lav_openok = lav_file.open( IO_ReadOnly );
++		lav_openok = lav_file.exists() && lav_file.open( IO_ReadOnly );
+ 		if (lav_openok)
+ 			lav_file.close();
+ 	}
+@@ -1303,7 +1303,7 @@
+ 	QFile cf("/proc/cpufreq");
+ 	bool haveProfile = false;
+ 	
+-	if (cf.open(IO_ReadOnly)) {
++	if (cf.exists() && cf.open(IO_ReadOnly)) {
+ 		while (!cf.atEnd()) {
+ 			QString l;
+ 		       	cf.readLine(l, 500);
+@@ -1318,7 +1318,7 @@
+ 	}
+ 	if (haveProfile) {
+ 		QFile ci("/proc/cpuinfo");
+-		if (ci.open(IO_ReadOnly)) {
++		if (ci.exists() && ci.open(IO_ReadOnly)) {
+ 			while (!ci.atEnd()) {
+ 				QString l;
+ 	       			ci.readLine(l, 500);
+@@ -1536,7 +1536,7 @@
+  	                    !(::access(name.latin1(), R_OK)==0 && ::acpi_helper_ok(0))) 
+ 				continue;
+ 			QFile f(name);
+-			if (f.open(IO_ReadOnly)) {
++			if (f.exists() && f.open(IO_ReadOnly)) {
+ 				while (!f.atEnd() && i < MAP_SIZE) {
+ 					QString l;
+       					f.readLine(l, 500);
+@@ -1574,7 +1574,7 @@
+ 				if (get_enable) {
+ 					name = QString("/proc/acpi/processor/")+dp->d_name+"/limit";
+ 					f.setName(name);
+-					if (f.open(IO_ReadOnly)) {
++					if (f.exists() && f.open(IO_ReadOnly)) {
+ 						while (!f.atEnd() && i < MAP_SIZE) {
+ 							QString l;
+ 							f.readLine(l, 500);
+@@ -1617,7 +1617,7 @@
+ 
+ 	// read current scaling policy
+ 	QFile f("/sys/devices/system/cpu/" + cpu + "/cpufreq/scaling_governor");
+-	if(!f.open(IO_ReadOnly) || f.atEnd())
++	if(!f.exists() || !f.open(IO_ReadOnly) || f.atEnd())
+ 		return CPUFREQ_NONE;
+ 	f.readLine(buffer, 256);
+ 	cur = buffer.stripWhiteSpace();
+@@ -1626,7 +1626,7 @@
+ 	// read available scaling policies
+ 	states.clear();
+ 	f.setName("/sys/devices/system/cpu/" + cpu + "/cpufreq/scaling_available_governors");
+-	if(!f.open(IO_ReadOnly))
++	if(!f.exists() || !f.open(IO_ReadOnly))
+ 		return CPUFREQ_NONE;
+ 	int count = 0;
+ 	if(!f.atEnd()) {
+@@ -1652,7 +1652,7 @@
+ 	states.clear();
+ 
+ 	QFile f("/proc/cpufreq");
+-	if (f.open(IO_ReadOnly)) {
++	if (f.exists() && f.open(IO_ReadOnly)) {
+ 		while (!f.atEnd()) {
+ 			QString l;
+ 			f.readLine(l, 1024);
+@@ -1688,7 +1688,7 @@
+ 
+ 	// current frequency
+ 	QFile f("/proc/sys/cpu/" + cpu + "/speed");
+-	if(!f.open(IO_ReadOnly) || f.atEnd())
++	if(!.f.exists() || !f.open(IO_ReadOnly) || f.atEnd())
+ 		return CPUFREQ_NONE;
+ 	f.readLine(buffer, 16);
+ 	f.close();
+@@ -1698,7 +1698,7 @@
+ 	const char* files[] = { "max", "min" };
+ 	for(int i = 0; i <= 1; ++i) {
+ 		f.setName("/proc/sys/cpu/" + cpu + "/speed-" + files[i]);
+-		if(!f.open(IO_ReadOnly) || f.atEnd())
++		if(!.f.exists() || !f.open(IO_ReadOnly) || f.atEnd())
+ 			return CPUFREQ_NONE;
+ 		f.readLine(buffer, 16);
+ 		f.close();
+@@ -1903,7 +1903,7 @@
+  	                if (::access(name.latin1(), R_OK)!=0)
+ 				continue;
+ 			QFile f(name);
+-			if (f.open(IO_ReadOnly)) {
++			if (f.exists() && f.open(IO_ReadOnly)) {
+ 				while (!f.atEnd()) {
+ 					QString l;
+       					f.readLine(l, 500);
+@@ -1968,9 +1968,9 @@
+ 		default:
+ 			break;
+ 		}
+-		if (name) {
++		if (name && !name->isEmpty()) {
+ 			QFile f(*name);
+-			if (f.open(IO_ReadOnly)) {
++			if (f.exists() && f.open(IO_ReadOnly)) {
+ 				while (!f.atEnd()) {
+ 					QString l;
+ 					f.readLine(l, 500);




More information about the pkg-kde-commits mailing list