diff options
Diffstat (limited to 'StdLib/LibC/Stdio/ferror.c')
-rw-r--r-- | StdLib/LibC/Stdio/ferror.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/StdLib/LibC/Stdio/ferror.c b/StdLib/LibC/Stdio/ferror.c index 5641b48038..4a3996fadd 100644 --- a/StdLib/LibC/Stdio/ferror.c +++ b/StdLib/LibC/Stdio/ferror.c @@ -2,7 +2,7 @@ Implementation of a subroutine version of the macro ferror,
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
@@ -48,6 +48,7 @@ #include <assert.h>
#include <stdio.h>
+#include <errno.h>
#include "reentrant.h"
#include "local.h"
@@ -59,6 +60,10 @@ ferror(FILE *fp) int r;
_DIAGASSERT(fp != NULL);
+ if(fp == NULL) {
+ errno = EINVAL;
+ return (EOF);
+ }
FLOCKFILE(fp);
r = __sferror(fp);
|