PowerTOP exits upon receiving SIGWINCH which is probably not correct
behaviour - it removes the possibility to resize the PowerTOP's window
if running inside the XTerm or such.

This issue originates from RH bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=644800

The proposed patch is attached

Jaroslav
--- powertop-1.13/powertop.c.orig	2009-12-18 14:28:04.000000000 +0100
+++ powertop-1.13/powertop.c	2009-12-18 14:23:38.000000000 +0100
@@ -36,6 +36,7 @@
 #include <time.h>
 #include <limits.h>
 #include <sys/stat.h>
+#include <errno.h>
 
 #include "powertop.h"
 
@@ -867,8 +868,12 @@
 
 		key = select(1, &rfds, NULL, NULL, &tv);
 
-		if (key && tv.tv_sec) ticktime = ticktime - tv.tv_sec - tv.tv_usec/1000000.0;
+		if (key > 0 && tv.tv_sec) ticktime = ticktime - tv.tv_sec - tv.tv_usec/1000000.0;
 
+		if (key == -1 && errno != EINTR) {
+			perror("select");
+			exit(EXIT_FAILURE);
+		}
 
 		stop_timerstats();
 		clear_lines();
@@ -1035,7 +1040,7 @@
 		else
 			ticktime = 45;
 
-		if (key) {
+		if (key > 0) {
 			char keychar;
 			int keystroke = fgetc(stdin);
 			if (keystroke == EOF)

_______________________________________________
Power mailing list
Power@bughost.org
http://www.bughost.org/mailman/listinfo/power

Reply via email to