diff options
Diffstat (limited to 'lib/libc/stdio/getc.c')
| -rw-r--r-- | lib/libc/stdio/getc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index 242c8396..2f59ba5c 100644 --- a/lib/libc/stdio/getc.c +++ b/lib/libc/stdio/getc.c @@ -1,9 +1,12 @@ -#include <libc.h> // for weak_reference -#include <stdio.h> // for fgetc, FILE, getc, getc_unlocked +#include <stdio.h> int getc(FILE *stream) { - return fgetc(stream); -} + int r; + + flockfile(stream); + r = getc_unlocked(stream); + funlockfile(stream); -weak_reference(getc, getc_unlocked); + return r; +} |
