summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2010-12-27 20:04:29 +0100
committerLars-Dominik Braun <lars@6xq.net>2010-12-27 20:04:29 +0100
commitc5c4dcc9cd471aa060be568491141703b96ae0f8 (patch)
tree5751d60aa16647d65671004bd16cc5f582ea96dd
parent9c1066ba50b82ab93079f668c78050a2fd646cf6 (diff)
downloadpianobar-c5c4dcc9cd471aa060be568491141703b96ae0f8.tar.gz
pianobar-c5c4dcc9cd471aa060be568491141703b96ae0f8.tar.bz2
pianobar-c5c4dcc9cd471aa060be568491141703b96ae0f8.zip
Fix high cpu usage if stdin is /dev/null
See issue #71.
-rw-r--r--src/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 2baad8e..908fcee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -167,6 +167,10 @@ static void BarMainHandleUserInput (BarApp_t *app) {
curFd = app->ctlFd;
}
buf = fgetc (curFd);
+ if (buf == EOF) {
+ /* select() is going wild if fdset contains EOFed fd's */
+ FD_CLR (fileno (curFd), &app->readSet);
+ }
size_t i;
for (i = 0; i < BAR_KS_COUNT; i++) {