]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/fclose.c
Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
[mirror_edk2.git] / StdLib / LibC / Stdio / fclose.c
index 3745e20f94e2b8306eb6e110dc16fbf4aeda774c..1ce28bcab4c3d10755a6879af8893cf29f5f1b6c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
     Implementation of fclose 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
@@ -59,6 +59,10 @@ fclose(FILE *fp)
   int r;\r
 \r
   _DIAGASSERT(fp != NULL);\r
+  if(fp == NULL) {\r
+    errno = EINVAL;\r
+    return (EOF);\r
+  }\r
 \r
   if (fp->_flags == 0) {  /* not open! */\r
     errno = EBADF;\r