libauthsrv: preserve readcons() error message from read() error

front
cinap_lenrek 2017-10-04 05:01:54 +02:00
parent 19b026bdbb
commit c11a3bb3b1
1 changed files with 6 additions and 1 deletions

View File

@ -37,8 +37,13 @@ readcons(char *prompt, char *def, int raw)
s = p, p += n;
}
if(read(fdin, p, 1) <= 0 || *p == 0x7f)
n = read(fdin, p, 1);
if(n < 0)
break;
if(n == 0 || *p == 0x7f){
werrstr("input aborted");
break;
}
if(*p == '\n' || *p == '\r'){
if(p == s && def != nil){