summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/feof.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/feof.c')
-rw-r--r--lib/libc/stdio/feof.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc/stdio/feof.c b/lib/libc/stdio/feof.c
index 3581100..60cad53 100644
--- a/lib/libc/stdio/feof.c
+++ b/lib/libc/stdio/feof.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 feof.
+ * feof has traditionally been a macro in <stdio.h>. That is no
+ * longer true because it needs to be thread-safe.
+ *
+ * #undef feof
*/
-#undef feof
-
int
-feof(fp)
- FILE *fp;
+feof(FILE *fp)
{
- return (__sfeof(fp));
+ int ret;
+
+ FLOCKFILE(fp);
+ ret= __sfeof(fp);
+ FUNLOCKFILE(fp);
+ return (ret);
}
OpenPOWER on IntegriCloud