make the mainloop immune against the signals

... needed at least for gdb ...

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/powerdebug.c b/powerdebug.c
index 7d89a7b..8e7e78e 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -288,10 +288,17 @@
 		tval.tv_sec = options->ticktime;
 		tval.tv_usec = (options->ticktime - tval.tv_sec) * 1000000;
 
+	again:
 		key = select(1, &readfds, NULL, NULL, &tval);
 		if (!key)
 			continue;
 
+		if (key < 0) {
+			if (errno == EINTR)
+				goto again;
+			break;
+		}
+
 		if (keystroke_callback(&enter_hit, &findparent_ncurses,
 				       clkname_str, &refreshwin, options))
 			break;