tapplied Jukka's stdinread patch - dwm - [fork] customized build of dwm, the dynamic window manager
HTML git clone git://src.adamsgaard.dk/dwm
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 27ef73507b69608c63bd7d1684b7d9987fbcce53
DIR parent 2b35fb643ec12e6f082aa78ca6a32447038d1490
HTML Author: arg@mig29 <unknown>
Date: Sun, 26 Nov 2006 13:31:36 +0100
applied Jukka's stdinread patch
Diffstat:
M main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
DIR diff --git a/main.c b/main.c
t@@ -274,9 +274,10 @@ main(int argc, char *argv[]) {
eprint("select failed\n");
}
if(FD_ISSET(STDIN_FILENO, &rd)) {
- switch(r = read(STDIN_FILENO, stext, sizeof(stext))) {
+ switch(r = read(STDIN_FILENO, stext, sizeof(stext) - 1)) {
case -1:
strncpy(stext, strerror(errno), sizeof(stext));
+ stext[sizeof(stext) - 1] = '\0';
readin = False;
break;
case 0:
t@@ -284,7 +285,7 @@ main(int argc, char *argv[]) {
readin = False;
break;
default:
- stext[r-1] = 0;
+ stext[r - (stext[r - 1] == '\n' ? 1 : 0)] = '\0';
}
drawstatus();
}