diff --git a/StdLib/LibC/Stdio/fvwrite.c b/StdLib/LibC/Stdio/fvwrite.c index 12773eff68..feddc348c1 100644 --- a/StdLib/LibC/Stdio/fvwrite.c +++ b/StdLib/LibC/Stdio/fvwrite.c @@ -106,11 +106,12 @@ __sfvwrite(FILE *fp, struct __suio *uio) GETIOV(;); w = (*fp->_write)(fp->_cookie, p, (int)MIN(len, BUFSIZ)); - if (w <= 0) + if (w < 0) goto err; p += w; len -= w; - } while ((uio->uio_resid -= w) != 0); + } while ((uio->uio_resid -= w) > 0); + uio->uio_resid = 0; // Just in case it went negative such as when NL is expanded to CR NL } else if ((fp->_flags & __SLBF) == 0) { /* * Fully buffered: fill partially full buffer, if any, diff --git a/StdLib/LibC/Uefi/SysCalls.c b/StdLib/LibC/Uefi/SysCalls.c index c3b210120b..a2b627bd12 100644 --- a/StdLib/LibC/Uefi/SysCalls.c +++ b/StdLib/LibC/Uefi/SysCalls.c @@ -708,7 +708,7 @@ open( if((oflags & O_TTY_INIT) && (filp->f_iflags & _S_ITTY) && (filp->devdata != NULL)) { // Initialize the device's termios flags to a "sane" value Termio = &((cIIO *)filp->devdata)->Termio; - Termio->c_iflag = ICRNL; + Termio->c_iflag = ICRNL | IGNSPEC; Termio->c_oflag = OPOST | ONLCR | OXTABS | ONOEOT | ONOCR | ONLRET | OCTRL; Termio->c_lflag = ECHO | ECHOE | ECHONL | ICANON; Termio->c_cc[VERASE] = 0x08; // ^H Backspace