summaryrefslogtreecommitdiffstats
path: root/StdLib
diff options
context:
space:
mode:
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2012-12-21 18:19:41 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2012-12-21 18:19:41 +0000
commit9f4b48a15d2dce4ae243920cdc83d46cc0eb4896 (patch)
tree89e990eb5c82dcd6a85b3474a298bcd20d8eb01a /StdLib
parent05cfd5f286a695ab765231f279527b588e4c460d (diff)
downloadedk2-9f4b48a15d2dce4ae243920cdc83d46cc0eb4896.tar.gz
edk2-9f4b48a15d2dce4ae243920cdc83d46cc0eb4896.tar.bz2
edk2-9f4b48a15d2dce4ae243920cdc83d46cc0eb4896.zip
StdLib: Fix issue with Canonical output expansion of NL to CR NL and similar expansions.
SysCalls.c: Add IGNSPEC to the "sane" termios settings so that, by default, function keys and other special keys are ignored. fvwrite.c: Line 109: Change test to less-than zero since zero is a valid value. Line 113: Change test to greater-than zero since we only want to loop when there are characters available. Line 114: Force uio_resid to zero since it might have become negative on line 113. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: lee.g.rosenbaum@intel.com Reviewed-by: jaben.carsey@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14013 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib')
-rw-r--r--StdLib/LibC/Stdio/fvwrite.c5
-rw-r--r--StdLib/LibC/Uefi/SysCalls.c2
2 files changed, 4 insertions, 3 deletions
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