Xinqi Bao's Git
projects
/
dwm.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
1d85225
)
dwm is now exit, if stdin is closed due broken pipe
author
[email protected]
<unknown>
Wed, 2 Aug 2006 10:33:24 +0000
(12:33 +0200)
committer
[email protected]
<unknown>
Wed, 2 Aug 2006 10:33:24 +0000
(12:33 +0200)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index
f09307b
..
86d72fa
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-165,7
+165,6
@@
main(int argc, char *argv[])
int i;
unsigned int mask;
fd_set rd;
int i;
unsigned int mask;
fd_set rd;
- Bool readin = True;
Window w;
XEvent ev;
XSetWindowAttributes wa;
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);
/* 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);
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 */
}
}
(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
else
- st
rcpy(stext, "broken pipe")
;
+ st
ext[strlen(stext) - 1] = 0
;
drawstatus();
}
}
drawstatus();
}
}