]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib: Fix issue with Canonical output expansion of NL to CR NL and similar expansions.
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 21 Dec 2012 18:19:41 +0000 (18:19 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 21 Dec 2012 18:19:41 +0000 (18:19 +0000)
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

StdLib/LibC/Stdio/fvwrite.c
StdLib/LibC/Uefi/SysCalls.c

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