Browse Source

applied Jukka's stdinread patch

master
arg@mig29 18 years ago
parent
commit
27ef73507b
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      main.c

+ 3
- 2
main.c View File

@ -274,9 +274,10 @@ main(int argc, char *argv[]) {
eprint("select failed\n"); eprint("select failed\n");
} }
if(FD_ISSET(STDIN_FILENO, &rd)) { 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: case -1:
strncpy(stext, strerror(errno), sizeof(stext)); strncpy(stext, strerror(errno), sizeof(stext));
stext[sizeof(stext) - 1] = '\0';
readin = False; readin = False;
break; break;
case 0: case 0:
@ -284,7 +285,7 @@ main(int argc, char *argv[]) {
readin = False; readin = False;
break; break;
default: default:
stext[r-1] = 0;
stext[r - (stext[r - 1] == '\n' ? 1 : 0)] = '\0';
} }
drawstatus(); drawstatus();
} }


Loading…
Cancel
Save