Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdio Do file locking.
details: https://anonhg.NetBSD.org/src/rev/f07f65beed48
branches: trunk
changeset: 480849:f07f65beed48
user: mycroft <mycroft%NetBSD.org@localhost>
date: Fri Jan 21 19:56:07 2000 +0000
description:
Do file locking.
diffstat:
lib/libc/stdio/vfscanf.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (57 lines):
diff -r 5ef989d4f8a2 -r f07f65beed48 lib/libc/stdio/vfscanf.c
--- a/lib/libc/stdio/vfscanf.c Fri Jan 21 19:55:02 2000 +0000
+++ b/lib/libc/stdio/vfscanf.c Fri Jan 21 19:56:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfscanf.c,v 1.24 1999/09/20 04:39:34 lukem Exp $ */
+/* $NetBSD: vfscanf.c,v 1.25 2000/01/21 19:56:07 mycroft Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: vfscanf.c,v 1.24 1999/09/20 04:39:34 lukem Exp $");
+__RCSID("$NetBSD: vfscanf.c,v 1.25 2000/01/21 19:56:07 mycroft Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -136,14 +136,18 @@
_DIAGASSERT(fp != NULL);
_DIAGASSERT(fmt0 != NULL);
+ FLOCKFILE(fp);
+
nassigned = 0;
nread = 0;
base = 0; /* XXX just to keep gcc happy */
ccfn = NULL; /* XXX just to keep gcc happy */
for (;;) {
c = *fmt++;
- if (c == 0)
+ if (c == 0) {
+ FUNLOCKFILE(fp);
return (nassigned);
+ }
if (isspace(c)) {
while ((fp->_r > 0 || __srefill(fp) == 0) &&
isspace(*fp->_p))
@@ -288,6 +292,7 @@
* Disgusting backwards compatibility hacks. XXX
*/
case '\0': /* compat */
+ FUNLOCKFILE(fp);
return (EOF);
default: /* compat */
@@ -670,8 +675,10 @@
}
}
input_failure:
+ FUNLOCKFILE(fp);
return (nassigned ? nassigned : EOF);
match_failure:
+ FUNLOCKFILE(fp);
return (nassigned);
}
Home |
Main Index |
Thread Index |
Old Index