applied Jukka's patch preventing some cornercases and making the EOF error message correct
This commit is contained in:
parent
2210ea7e3b
commit
35e96b8deb
3
main.c
3
main.c
|
@ -277,10 +277,11 @@ main(int argc, char *argv[]) {
|
||||||
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
|
switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
|
||||||
case -1:
|
case -1:
|
||||||
strncpy(stext, strerror(errno), sizeof stext - 1);
|
strncpy(stext, strerror(errno), sizeof stext - 1);
|
||||||
|
stext[sizeof stext - 1] = '\0';
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
strncpy(stext, "EOF", sizeof stext);
|
strncpy(stext, "EOF", 4);
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue