X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/blobdiff_plain/fcd91bd96fd37fb50458906bcf0015b347f72dd4..e0f95098eeba0176864b9cafe6d69b5b7bc0e73f:/lib/libc/stdio/fwalk.c diff --git a/lib/libc/stdio/fwalk.c b/lib/libc/stdio/fwalk.c index b54d52143b..2e9f07db8e 100644 --- a/lib/libc/stdio/fwalk.c +++ b/lib/libc/stdio/fwalk.c @@ -13,10 +13,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -34,13 +30,13 @@ * SUCH DAMAGE. * * @(#)fwalk.c 8.1 (Berkeley) 6/4/93 - * $FreeBSD: src/lib/libc/stdio/fwalk.c,v 1.6.2.1 2001/03/05 11:27:49 obrien Exp $ + * $FreeBSD: src/lib/libc/stdio/fwalk.c,v 1.10 2007/01/09 00:28:06 imp Exp $ * $DragonFly: src/lib/libc/stdio/fwalk.c,v 1.5 2005/07/23 20:23:06 joerg Exp $ */ -#include #include #include +#include #include "local.h" #include "priv_stdio.h" @@ -53,13 +49,17 @@ _fwalk(int (*function)(FILE *)) ret = 0; /* - * It should be safe to walk the list without locking it; + * It should be safe to walk the list without locking it; * new nodes are only added to the end and none are ever * removed. + * + * Avoid locking this list while walking it or else you will + * introduce a potential deadlock in [at least] refill.c. */ for (g = &__sglue; g != NULL; g = g->next) for (fp = g->iobs, n = g->niobs; --n >= 0; fp++) - if (fp->pub._flags != 0) + if ((fp->pub._flags != 0) && + ((fp->pub._flags & __SIGN) == 0)) ret |= (*function)(fp); return (ret); }