aboutsummaryrefslogtreecommitdiff
path: root/libio/iofsetpos.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/iofsetpos.c')
-rw-r--r--libio/iofsetpos.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c
index 72db3b1fa0..c8897522d6 100644
--- a/libio/iofsetpos.c
+++ b/libio/iofsetpos.c
@@ -30,7 +30,9 @@ _IO_fsetpos (fp, posp)
_IO_FILE* fp;
const _IO_fpos_t *posp;
{
+ int result;
CHECK_FILE (fp, EOF);
+ _IO_flockfile (fp);
if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
{
/*ANSI explicily requires setting errno to a positive value on failure.*/
@@ -38,9 +40,12 @@ _IO_fsetpos (fp, posp)
if (errno == 0)
errno = EIO;
#endif
- return EOF;
+ result = EOF;
}
- return 0;
+ else
+ result = 0;
+ _IO_funlockfile (fp);
+ return result;
}
weak_alias (_IO_fsetpos, fsetpos)