From e9ae07b0aaaf9f3185fa4605b280849fee9766c4 Mon Sep 17 00:00:00 2001 From: Hiten Pandya Date: Wed, 9 Jun 2004 19:40:59 +0000 Subject: [PATCH] Add a 'big fat comment' about the FUNLOCKFILE(fp) implementation and why it needs to be called before modification of the FILE flags. Requested-by: Matthew Dillon --- lib/libc/stdio/fclose.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c index c950a99a3a..dabe772407 100644 --- a/lib/libc/stdio/fclose.c +++ b/lib/libc/stdio/fclose.c @@ -35,7 +35,7 @@ * * @(#)fclose.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/stdio/fclose.c,v 1.8 1999/11/21 22:34:57 dt Exp $ - * $DragonFly: src/lib/libc/stdio/fclose.c,v 1.6 2004/06/09 19:28:04 hmp Exp $ + * $DragonFly: src/lib/libc/stdio/fclose.c,v 1.7 2004/06/09 19:40:59 hmp Exp $ */ #include @@ -63,6 +63,14 @@ fclose(FILE *fp) FREEUB(fp); if (HASLB(fp)) FREELB(fp); + /* + * XXX-HITEN the FUNLOCKFILE(fp) cannot be moved below because of + * the way the funlockfile() implementation works; it surrounds + * the code with a if (fp->_file >= 0)... terrible, just terrible. + * + * This mess will be cleaned up when I rewrite the file contention + * locking code. + */ FUNLOCKFILE(fp); fp->_file = -1; fp->_r = fp->_w = 0; /* Mess up if reaccessed. */ -- 2.41.0