aboutsummaryrefslogtreecommitdiff
path: root/libio/iofgets.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/iofgets.c')
-rw-r--r--libio/iofgets.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libio/iofgets.c b/libio/iofgets.c
index 88d4bd518e..369251f22a 100644
--- a/libio/iofgets.c
+++ b/libio/iofgets.c
@@ -35,6 +35,7 @@ _IO_fgets (buf, n, fp)
CHECK_FILE (fp, NULL);
if (n <= 0)
return NULL;
+ __libc_cleanup_region_start (&_IO_funlockfile, fp);
_IO_flockfile (fp);
count = _IO_getline (fp, buf, n - 1, '\n', 1);
if (count == 0 || (fp->_IO_file_flags & _IO_ERR_SEEN))
@@ -44,7 +45,7 @@ _IO_fgets (buf, n, fp)
buf[count] = '\0';
result = buf;
}
- _IO_funlockfile (fp);
+ __libc_cleanup_region_end (1);
return result;
}