summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Stdio/putc.c
diff options
context:
space:
mode:
Diffstat (limited to 'StdLib/LibC/Stdio/putc.c')
-rw-r--r--StdLib/LibC/Stdio/putc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/StdLib/LibC/Stdio/putc.c b/StdLib/LibC/Stdio/putc.c
index 891e747a56..25f49f8646 100644
--- a/StdLib/LibC/Stdio/putc.c
+++ b/StdLib/LibC/Stdio/putc.c
@@ -2,11 +2,11 @@
Implementation of a subroutine version of the macro putc,
as declared in <stdio.h>.
- 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.
@@ -64,6 +64,10 @@ putc(int c, FILE *fp)
int r;
_DIAGASSERT(fp != NULL);
+ if(fp == NULL) {
+ errno = EINVAL;
+ return (EOF);
+ }
FLOCKFILE(fp);
r = __sputc(c, fp);
@@ -75,6 +79,10 @@ int
putc_unlocked(int c, FILE *fp)
{
_DIAGASSERT(fp != NULL);
+ if(fp == NULL) {
+ errno = EINVAL;
+ return (EOF);
+ }
return (__sputc(c, fp));
}