Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
dwm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed viewall(), replaced with view(-1); added tag(-1) to tag a client with all...
[dwm.git]
/
main.c
diff --git
a/main.c
b/main.c
index
f196df7
..
062f9d7
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-277,15
+277,16
@@
main(int argc, char *argv[]) {
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
case -1:
strncpy(stext, strerror(errno), sizeof stext - 1);
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
case -1:
strncpy(stext, strerror(errno), sizeof stext - 1);
+ stext[sizeof stext - 1] = '\0';
readin = False;
break;
case 0:
readin = False;
break;
case 0:
- strncpy(stext, "EOF", sizeof stext);
+ strncpy(stext, "EOF", 4);
readin = False;
break;
default:
readin = False;
break;
default:
- stext[r - (stext[r - 1] == '\n' ? 1 : 0)] = '\0';
- for(p = stext + strlen(stext) - 1; p > stext && *p != '\n'; --p);
+ for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0');
+ for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p);
if(p > stext)
strncpy(stext, p + 1, sizeof stext);
}
if(p > stext)
strncpy(stext, p + 1, sizeof stext);
}