]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Uefi/InteractiveIO/CanonRead.c
StdLib: Some deployed versions of the Simple Text Input Protocol randomly return...
[mirror_edk2.git] / StdLib / LibC / Uefi / InteractiveIO / CanonRead.c
index db6af6e4bfa60ff3956b57a53b4be0ad786414e1..8c8e076d80b6f6be7efe719ac53a6d2cd6038bf4 100644 (file)
@@ -3,7 +3,7 @@
 \r
   The functions assume that isatty() is TRUE at the time they are called.\r
 \r
-  Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
   distribution.  The full text of the license may be found at\r
@@ -87,6 +87,10 @@ IIO_CanonRead (
   //  Input and process characters until BufferSize is exhausted.\r
   do {\r
     InChar = IIO_GetInChar(filp, FirstRead);\r
+    if (InChar == WEOF) {\r
+      NumRead = 0;\r
+      break;\r
+    }\r
     FirstRead = FALSE;\r
     Activate  = TRUE;\r
     if(InChar == CHAR_CARRIAGE_RETURN) {\r
@@ -128,6 +132,8 @@ IIO_CanonRead (
     }\r
     else if(CCEQ(Termio->c_cc[VEOF], InChar)) {\r
       InChar = WEOF;\r
+      NumRead = 0;\r
+      EchoIsOK = FALSE;   // Buffer, but don't echo this character\r
     }\r
     else if(CCEQ(Termio->c_cc[VEOL], InChar)) {\r
       EchoIsOK = FALSE;   // Buffer, but don't echo this character\r