diff options
author | dt <dt@FreeBSD.org> | 1999-11-20 14:52:03 +0000 |
---|---|---|
committer | dt <dt@FreeBSD.org> | 1999-11-20 14:52:03 +0000 |
commit | 75d26bf57405e325ab98e1c789f13cfd1cbdb9a2 (patch) | |
tree | 323953161905324b05c84aadc74d22ee76b3311d /lib/libc | |
parent | 669c69aa24a5ba814eb863e42fda2b128040f429 (diff) | |
download | FreeBSD-src-75d26bf57405e325ab98e1c789f13cfd1cbdb9a2.zip FreeBSD-src-75d26bf57405e325ab98e1c789f13cfd1cbdb9a2.tar.gz |
Add (FILE *) locking.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/freopen.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 7a8a3ef..9de6724 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -35,7 +35,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$FreeBSD$"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -45,6 +49,7 @@ static char sccsid[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <libc_private.h> #include "local.h" /* @@ -65,6 +70,8 @@ freopen(file, mode, fp) return (NULL); } + FLOCKFILE(fp); + if (!__sdidinit) __sinit(); @@ -129,6 +136,7 @@ freopen(file, mode, fp) if (f < 0) { /* did not get it after all */ fp->_flags = 0; /* set it free */ errno = sverrno; /* restore in case _close clobbered */ + FUNLOCKFILE(fp); return (NULL); } @@ -151,5 +159,6 @@ freopen(file, mode, fp) fp->_write = __swrite; fp->_seek = __sseek; fp->_close = __sclose; + FUNLOCKFILE(fp); return (fp); } |