summaryrefslogtreecommitdiff
path: root/src/stdio/fileno.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/fileno.c')
-rw-r--r--src/stdio/fileno.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c
index 9ffb26d5..ba7f9391 100644
--- a/src/stdio/fileno.c
+++ b/src/stdio/fileno.c
@@ -2,6 +2,11 @@
int fileno(FILE *f)
{
+ /* f->fd never changes, but the lock must be obtained and released
+ * anyway since this function cannot return while another thread
+ * holds the lock. */
+ FLOCK(f);
+ FUNLOCK(f);
return f->fd;
}