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:
authorJeff Johnston <jjohnstn@redhat.com>2004-04-02 04:59:17 +0400
committerJeff Johnston <jjohnstn@redhat.com>2004-04-02 04:59:17 +0400
commit38f4f02370cd42e2e4f8cc46e51013581d0973d0 (patch)
tree6078ea237a21e21c29e7349aa61b0d79d7f4d173 /newlib/libc/stdio
parentb6edea61f22b95a1832b953ddbae29c28cc982e9 (diff)
2004-04-01 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/vfscanf.c (__svfscanf_r): Add locking/unlocking of file.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/vfscanf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index eef38b9e8..de8e847c0 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -285,6 +285,8 @@ __svfscanf_r (rptr, fp, fmt0, ap)
static _CONST short basefix[17] =
{10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
+ _flockfile (fp);
+
nassigned = 0;
nread = 0;
for (;;)
@@ -297,7 +299,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
#endif
fmt += nbytes;
if (wc == 0)
- return nassigned;
+ goto all_done;
if (nbytes == 1 && isspace (wc))
{
for (;;)
@@ -499,6 +501,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
* Disgusting backwards compatibility hacks. XXX
*/
case '\0': /* compat */
+ _funlockfile (fp);
return EOF;
default: /* compat */
@@ -1130,8 +1133,11 @@ __svfscanf_r (rptr, fp, fmt0, ap)
}
}
input_failure:
+ _funlockfile (fp);
return nassigned ? nassigned : -1;
match_failure:
+all_done:
+ _funlockfile (fp);
return nassigned;
}