]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/fgetpos.c
Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
[mirror_edk2.git] / StdLib / LibC / Stdio / fgetpos.c
index f076718278e4962f25e14c09c4172c7289ee106d..61d6f756d0fd4e4bcd9ca105a375dfdcdfced30c 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
     Implementation of fgetpos 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
@@ -56,5 +56,10 @@ fgetpos(FILE *fp, fpos_t *pos)
   _DIAGASSERT(fp != NULL);\r
   _DIAGASSERT(pos != NULL);\r
 \r
+  if(fp == NULL) {\r
+    errno = EINVAL;\r
+    return (EOF);\r
+  }\r
+\r
   return((*pos = (off_t)ftello(fp)) == (off_t)-1);\r
 }\r