diff options
author | arg@10ksloc.org <unknown> | 2006-08-02 12:33:24 +0200 |
---|---|---|
committer | arg@10ksloc.org <unknown> | 2006-08-02 12:33:24 +0200 |
commit | 0cf3ba0eab1e3b05515907b29fbb739321a7cbed (patch) | |
tree | 3170d2dda9fa83da04c0aa3dfda82654a0e42e98 /main.c | |
parent | 1d852259526e41ebaad7325ee42c118b1cc12f71 (diff) | |
download | dwm-0cf3ba0eab1e3b05515907b29fbb739321a7cbed.tar.gz dwm-0cf3ba0eab1e3b05515907b29fbb739321a7cbed.tar.bz2 dwm-0cf3ba0eab1e3b05515907b29fbb739321a7cbed.zip |
dwm is now exit, if stdin is closed due broken pipe
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -165,7 +165,6 @@ main(int argc, char *argv[]) int i; unsigned int mask; fd_set rd; - Bool readin = True; Window w; XEvent ev; XSetWindowAttributes wa; @@ -252,8 +251,7 @@ main(int argc, char *argv[]) /* main event loop, reads status text from stdin as well */ while(running) { FD_ZERO(&rd); - if(readin) - FD_SET(STDIN_FILENO, &rd); + FD_SET(STDIN_FILENO, &rd); FD_SET(ConnectionNumber(dpy), &rd); i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); @@ -269,12 +267,11 @@ main(int argc, char *argv[]) (handler[ev.type])(&ev); /* call handler */ } } - if(readin && FD_ISSET(STDIN_FILENO, &rd)) { - readin = NULL != fgets(stext, sizeof(stext), stdin); - if(readin) - stext[strlen(stext) - 1] = 0; + if(FD_ISSET(STDIN_FILENO, &rd)) { + if(!fgets(stext, sizeof(stext), stdin)) + break; else - strcpy(stext, "broken pipe"); + stext[strlen(stext) - 1] = 0; drawstatus(); } } |