summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2010-10-18 19:56:17 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2010-10-18 19:56:17 +0200
commit4ea9c3f77b298b4da5e95062023cafbc7c19a021 (patch)
tree16bab3e7554720a6fa6658c0b6f961d21ead3649 /src
parentd39745491dc911c7b7118402d640d54d50e845ab (diff)
downloadpianobar-windows-4ea9c3f77b298b4da5e95062023cafbc7c19a021.tar.gz
pianobar-windows-4ea9c3f77b298b4da5e95062023cafbc7c19a021.tar.bz2
pianobar-windows-4ea9c3f77b298b4da5e95062023cafbc7c19a021.zip
Initialize main fd array
Cherry-picked from Josh Elsasser's unixsocket patch.
Diffstat (limited to 'src')
-rw-r--r--src/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 19cdad2..40bd64a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -60,7 +60,7 @@ int main (int argc, char **argv) {
char ctlPath[1024];
FILE *ctlFd = NULL;
struct timeval selectTimeout;
- int maxFd, selectFds[2];
+ int maxFd, selectFds[2] = {-1, -1};
fd_set readSet, readSetCopy;
char buf = '\0';
/* terminal attributes _before_ we started messing around with ~ECHO */
@@ -313,7 +313,7 @@ int main (int argc, char **argv) {
if (FD_ISSET(selectFds[0], &readSetCopy)) {
curFd = stdin;
- } else if (FD_ISSET(selectFds[1], &readSetCopy)) {
+ } else if (selectFds[1] != -1 && FD_ISSET(selectFds[1], &readSetCopy)) {
curFd = ctlFd;
}
buf = fgetc (curFd);