]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/getc.c
StdLib/LibC/StdLib/Malloc.c: Revert cast removal to fix GCC build breakage.
[mirror_edk2.git] / StdLib / LibC / Stdio / getc.c
index c0f367b892b27df6409f019a87b5b972d93d054b..755251eef721ca6d76f4a0e52fbc464194dad843 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
     Implementation of getc as declared in <stdio.h>.\r
 \r
-    Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+    Copyright (c) 2010 - 2011, 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 that accompanies this\r
     distribution.  The full text of the license may be found at\r
-    http://opensource.org/licenses/bsd-license.php.\r
+    http://opensource.org/licenses/bsd-license.\r
 \r
     THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
     WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@@ -63,6 +63,10 @@ getc(FILE *fp)
   int r;\r
 \r
   _DIAGASSERT(fp != NULL);\r
+  if(fp == NULL) {\r
+    errno = ENOSTR;\r
+    return (EOF);\r
+  }\r
 \r
   FLOCKFILE(fp);\r
   r = __sgetc(fp);\r
@@ -75,6 +79,10 @@ getc_unlocked(FILE *fp)
 {\r
 \r
   _DIAGASSERT(fp != NULL);\r
+  if(fp == NULL) {\r
+    errno = ENOSTR;\r
+    return EOF;\r
+  }\r
 \r
   return (__sgetc(fp));\r
 }\r