aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ferror.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2001-02-11 22:06:43 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2001-02-11 22:06:43 +0000
commit29ac6bd228d1c75dc4c19105fa149861bff04720 (patch)
tree91800b480f9efe4c0d90fe0b653e4bb1125f24f7 /lib/libc/stdio/ferror.c
parent5b62961a494b0271f6029f0c8f1e8c92a2267fe7 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/ferror.c')
-rw-r--r--lib/libc/stdio/ferror.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc/stdio/ferror.c b/lib/libc/stdio/ferror.c
index 2311926b1bd2..c4424c6a9900 100644
--- a/lib/libc/stdio/ferror.c
+++ b/lib/libc/stdio/ferror.c
@@ -42,16 +42,24 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
#include <stdio.h>
+#include "un-namespace.h"
+#include "libc_private.h"
/*
- * A subroutine version of the macro ferror.
+ * ferror has traditionally been a macro in <stdio.h>. That is no
+ * longer true because it needs to be thread-safe.
+ *
+ * #undef ferror
*/
-#undef ferror
-
int
-ferror(fp)
- FILE *fp;
+ferror(FILE *fp)
{
- return (__sferror(fp));
+ int ret;
+
+ FLOCKFILE(fp);
+ ret = __sferror(fp);
+ FUNLOCKFILE(fp);
+ return (ret);
}