Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/fgetpos.c')
-rw-r--r--newlib/libc/stdio/fgetpos.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c
index 214021a84..ed6f5cfd3 100644
--- a/newlib/libc/stdio/fgetpos.c
+++ b/newlib/libc/stdio/fgetpos.c
@@ -53,9 +53,14 @@ _DEFUN (fgetpos, (fp, pos),
FILE * fp _AND
fpos_t * pos)
{
+ _flockfile(fp);
*pos = ftell (fp);
if (*pos != -1)
- return 0;
+ {
+ _funlockfile(fp);
+ return 0;
+ }
+ _funlockfile(fp);
return 1;
}