diff options
author | Daniel Eischen <deischen@FreeBSD.org> | 2001-02-11 22:06:43 +0000 |
---|---|---|
committer | Daniel Eischen <deischen@FreeBSD.org> | 2001-02-11 22:06:43 +0000 |
commit | 29ac6bd228d1c75dc4c19105fa149861bff04720 (patch) | |
tree | 91800b480f9efe4c0d90fe0b653e4bb1125f24f7 /lib/libc/stdio/fflush.c | |
parent | 5b62961a494b0271f6029f0c8f1e8c92a2267fe7 (diff) | |
download | src-29ac6bd228d1c75dc4c19105fa149861bff04720.tar.gz src-29ac6bd228d1c75dc4c19105fa149861bff04720.zip |
Notes
Diffstat (limited to 'lib/libc/stdio/fflush.c')
-rw-r--r-- | lib/libc/stdio/fflush.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index 09d346bc0f8b..5c1eaa141741 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -49,6 +49,8 @@ static const char rcsid[] = #include "libc_private.h" #include "local.h" +static int sflush_locked(FILE *); + /* * Flush a single file, or (if fp is NULL) all files. * MT-safe version @@ -59,7 +61,7 @@ fflush(FILE *fp) int retval; if (fp == NULL) - return (_fwalk(__sflush)); + return (_fwalk(sflush_locked)); FLOCKFILE(fp); if ((fp->_flags & (__SWR | __SRW)) == 0) { errno = EBADF; @@ -80,7 +82,7 @@ __fflush(FILE *fp) int retval; if (fp == NULL) - return (_fwalk(__sflush)); + return (_fwalk(sflush_locked)); if ((fp->_flags & (__SWR | __SRW)) == 0) { errno = EBADF; retval = EOF; @@ -120,3 +122,14 @@ __sflush(FILE *fp) } return (0); } + +static int +sflush_locked(FILE *fp) +{ + int ret; + + FLOCKFILE(fp); + ret = __sflush(fp); + FUNLOCKFILE(fp); + return (ret); +} |