summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Stdio/makebuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Stdio/makebuf.c')
-rw-r--r--StdLib/LibC/Stdio/makebuf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/StdLib/LibC/Stdio/makebuf.c b/StdLib/LibC/Stdio/makebuf.c
index 75c475c3a5..4e69be1275 100644
--- a/StdLib/LibC/Stdio/makebuf.c
+++ b/StdLib/LibC/Stdio/makebuf.c
@@ -1,11 +1,11 @@
/** @file
Implementation of internal file buffer allocation functions.
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License that accompanies this
distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php.
+ http://opensource.org/licenses/bsd-license.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -74,6 +74,7 @@ __smakebuf(FILE *fp)
_DIAGASSERT(fp != NULL);
+ if (fp != NULL) {
if (fp->_flags & __SNBF) {
fp->_bf._base = fp->_p = fp->_nbuf;
fp->_bf._size = 1;
@@ -93,6 +94,7 @@ __smakebuf(FILE *fp)
if (couldbetty || isatty(fp->_file))
flags |= __SLBF;
fp->_flags |= flags;
+ }
}
/*
@@ -106,6 +108,9 @@ __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty)
_DIAGASSERT(fp != NULL);
_DIAGASSERT(bufsize != NULL);
_DIAGASSERT(couldbetty != NULL);
+ if(fp == NULL) {
+ return (__SNPT);
+ }
if (fp->_file < 0 || fstat(fp->_file, &st) < 0) {
*couldbetty = 0;