summary refs log tree commit diff
path: root/libio/iofread.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/iofread.c')
-rw-r--r--libio/iofread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libio/iofread.c b/libio/iofread.c
index bad94ca17b..af6bc33f24 100644
--- a/libio/iofread.c
+++ b/libio/iofread.c
@@ -36,9 +36,10 @@ _IO_fread (buf, size, count, fp)
   CHECK_FILE (fp, 0);
   if (bytes_requested == 0)
     return 0;
+  __libc_cleanup_region_start (&_IO_funlockfile, fp);
   _IO_flockfile (fp);
   bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
-  _IO_funlockfile (fp);
+  __libc_cleanup_region_end (1);
   return bytes_requested == bytes_read ? count : bytes_read / size;
 }
 weak_alias (_IO_fread, fread)