bugfix: reopen fifo on EOF

This commit is contained in:
Julien Danjou 2007-10-12 17:41:54 +02:00
parent 23bbe21428
commit 4f8accb8df
1 changed files with 9 additions and 6 deletions

View File

@ -389,15 +389,13 @@ main(int argc, char *argv[])
cfd = open(fifopath, O_RDONLY | O_NDELAY); cfd = open(fifopath, O_RDONLY | O_NDELAY);
p_delete(&fifopath);
FD_ZERO(&rd);
if(cfd > 0)
FD_SET(cfd, &rd);
FD_SET(xfd, &rd);
/* main event loop, also reads status text from stdin */ /* main event loop, also reads status text from stdin */
while(running) while(running)
{ {
FD_ZERO(&rd);
if(cfd >= 0)
FD_SET(cfd, &rd);
FD_SET(xfd, &rd);
if(select(MAX(xfd, cfd) + 1, &rd, NULL, NULL, NULL) == -1) if(select(MAX(xfd, cfd) + 1, &rd, NULL, NULL, NULL) == -1)
{ {
if(errno == EINTR) if(errno == EINTR)
@ -416,6 +414,8 @@ main(int argc, char *argv[])
cfd = -1; cfd = -1;
break; break;
case 0: case 0:
close(cfd);
cfd = open(fifopath, O_RDONLY | O_NDELAY);
break; break;
default: default:
parse_control(buf, awesomeconf); parse_control(buf, awesomeconf);
@ -430,6 +430,9 @@ main(int argc, char *argv[])
handler[ev.type](&ev, awesomeconf); /* call handler */ handler[ev.type](&ev, awesomeconf); /* call handler */
} }
} }
p_delete(&fifopath);
cleanup(awesomeconf); cleanup(awesomeconf);
XCloseDisplay(dpy); XCloseDisplay(dpy);