diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-03 02:24:37 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-03 02:24:37 +0000 |
| commit | 5e00917d95e5b28db7af2ce3dce4f19ba54f1e2c (patch) | |
| tree | 1e9ab56239da83bdafac4d6f346eacc369bb761e /lib/libc/stdio/fvwrite.c | |
| parent | bb76bd11806c559ce618d65d888ff2766fcc8909 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/fvwrite.c')
| -rw-r--r-- | lib/libc/stdio/fvwrite.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index efcfffbaf4e0..91968250972c 100644 --- a/lib/libc/stdio/fvwrite.c +++ b/lib/libc/stdio/fvwrite.c @@ -64,7 +64,7 @@ __sfvwrite(fp, uio) register struct __siov *iov; register int w, s; char *nl; - int nlknown, nldist, firsttime; + int nlknown, nldist; if ((len = uio->uio_resid) == 0) return (0); @@ -86,22 +86,13 @@ __sfvwrite(fp, uio) len = iov->iov_len; \ iov++; \ } - firsttime = 1; if (fp->_flags & __SNBF) { /* * Unbuffered: write up to BUFSIZ bytes at a time. */ do { GETIOV(;); - if (firsttime) { - if ((fp->_flags & __SAPP) && - _sseek(fp, (fpos_t)0, SEEK_END) == -1) - goto err; - /* In case FAPPEND mode is set. */ - fp->_flags &= ~__SOFF; - firsttime = 0; - } - w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ)); + w = _swrite(fp, p, MIN(len, BUFSIZ)); if (w <= 0) goto err; p += w; @@ -156,15 +147,7 @@ __sfvwrite(fp, uio) goto err; } else if (len >= (w = fp->_bf._size)) { /* write directly */ - if (firsttime) { - if ((fp->_flags & __SAPP) && - _sseek(fp, (fpos_t)0, SEEK_END) == -1) - goto err; - /* In case FAPPEND mode is set. */ - fp->_flags &= ~__SOFF; - firsttime = 0; - } - w = (*fp->_write)(fp->_cookie, p, w); + w = _swrite(fp, p, w); if (w <= 0) goto err; } else { @@ -203,15 +186,7 @@ __sfvwrite(fp, uio) if (__fflush(fp)) goto err; } else if (s >= (w = fp->_bf._size)) { - if (firsttime) { - if ((fp->_flags & __SAPP) && - _sseek(fp, (fpos_t)0, SEEK_END) == -1) - goto err; - /* In case FAPPEND mode is set. */ - fp->_flags &= ~__SOFF; - firsttime = 0; - } - w = (*fp->_write)(fp->_cookie, p, w); + w = _swrite(fp, p, w); if (w <= 0) goto err; } else { |
