about summary refs log tree commit diff
path: root/src/stdio/fgetc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fgetc.c')
-rw-r--r--src/stdio/fgetc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stdio/fgetc.c b/src/stdio/fgetc.c
index da638684..4d8aca37 100644
--- a/src/stdio/fgetc.c
+++ b/src/stdio/fgetc.c
@@ -3,9 +3,10 @@
 int fgetc(FILE *f)
 {
 	int c;
-	FLOCK(f);
+	if (f->lock < 0 || !__lockfile(f))
+		return getc_unlocked(f);
 	c = getc_unlocked(f);
-	FUNLOCK(f);
+	__unlockfile(f);
 	return c;
 }