dwm is now exit, if stdin is closed due broken pipe
This commit is contained in:
parent
1d85225952
commit
0cf3ba0eab
11
main.c
11
main.c
|
@ -165,7 +165,6 @@ main(int argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
fd_set rd;
|
fd_set rd;
|
||||||
Bool readin = True;
|
|
||||||
Window w;
|
Window w;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
@ -252,7 +251,6 @@ main(int argc, char *argv[])
|
||||||
/* main event loop, reads status text from stdin as well */
|
/* main event loop, reads status text from stdin as well */
|
||||||
while(running) {
|
while(running) {
|
||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
if(readin)
|
|
||||||
FD_SET(STDIN_FILENO, &rd);
|
FD_SET(STDIN_FILENO, &rd);
|
||||||
FD_SET(ConnectionNumber(dpy), &rd);
|
FD_SET(ConnectionNumber(dpy), &rd);
|
||||||
|
|
||||||
|
@ -269,12 +267,11 @@ main(int argc, char *argv[])
|
||||||
(handler[ev.type])(&ev); /* call handler */
|
(handler[ev.type])(&ev); /* call handler */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
|
if(FD_ISSET(STDIN_FILENO, &rd)) {
|
||||||
readin = NULL != fgets(stext, sizeof(stext), stdin);
|
if(!fgets(stext, sizeof(stext), stdin))
|
||||||
if(readin)
|
break;
|
||||||
stext[strlen(stext) - 1] = 0;
|
|
||||||
else
|
else
|
||||||
strcpy(stext, "broken pipe");
|
stext[strlen(stext) - 1] = 0;
|
||||||
drawstatus();
|
drawstatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue