]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/fgetstr.c
Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
[mirror_edk2.git] / StdLib / LibC / Stdio / fgetstr.c
index 7364d3b8910045236f2c6de24e2bb65b7030b8d9..9e898f3263bce5f693a0f218b1d673702311b9c4 100644 (file)
@@ -1,6 +1,13 @@
-/*  $NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $ */\r
+/*\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.\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
 \r
-/*-\r
  * Copyright (c) 1990, 1993\r
  *  The Regents of the University of California.  All rights reserved.\r
  *\r
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
  * SUCH DAMAGE.\r
+\r
+    $NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $\r
+    fgetline.c  8.1 (Berkeley) 6/4/93\r
+*/\r
+\r
+/*-\r
  */\r
 #include  <LibConfig.h>\r
 #include <sys/EfiCdefs.h>\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-#if 0\r
-static char sccsid[] = "@(#)fgetline.c  8.1 (Berkeley) 6/4/93";\r
-#else\r
-__RCSID("$NetBSD: fgetstr.c,v 1.4 2006/11/24 19:46:58 christos Exp $");\r
-#endif\r
-#endif /* LIBC_SCCS and not lint */\r
 \r
 #include "namespace.h"\r
 \r
 #include <assert.h>\r
+#include  <errno.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
@@ -66,6 +73,10 @@ __slbexpand(FILE *fp, size_t newsize)
   ++newsize;\r
 #endif\r
   _DIAGASSERT(fp != NULL);\r
+  if(fp == NULL) {\r
+    errno = EINVAL;\r
+    return (-1);\r
+  }\r
 \r
   if ((size_t)fp->_lb._size >= newsize)\r
     return (0);\r
@@ -92,6 +103,10 @@ __fgetstr(FILE *fp, size_t *lenp, int sep)
 \r
   _DIAGASSERT(fp != NULL);\r
   _DIAGASSERT(lenp != NULL);\r
+  if(fp == NULL) {\r
+    errno = EINVAL;\r
+    return (NULL);\r
+  }\r
 \r
   /* make sure there is input */\r
   if (fp->_r <= 0 && __srefill(fp)) {\r