diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-07 17:16:02 +0000 | 
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-09-07 17:16:02 +0000 | 
| commit | 1b89a29689c955b26fa7a48d89ed6eaa20a95994 (patch) | |
| tree | 240376cf6f062814d01e451fa3ae3034199762e0 /lib/libc/stdio/stdio.c | |
| parent | 366a302c4b7b815c4df05f45951584d9f540a013 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/stdio.c')
| -rw-r--r-- | lib/libc/stdio/stdio.c | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index 96cfcae6e21b..4bee60804d4a 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -126,9 +126,15 @@ _swrite(fp, buf, n)  	int n;  {  	int ret; +	int serrno; -	if (fp->_flags & __SAPP) -		(void)_sseek(fp, (fpos_t)0, SEEK_END); +	if (fp->_flags & __SAPP) { +		serrno = errno; +		if (_sseek(fp, (fpos_t)0, SEEK_END) == -1 && +		    (fp->_flags & __SOPT)) +			return (-1); +		errno = serrno; +	}  	ret = (*fp->_write)(fp->_cookie, buf, n);  	/* __SOFF removed even on success in case O_APPEND mode is set. */  	if (ret >= 0) { @@ -167,7 +173,8 @@ _sseek(fp, offset, whence)  		if (errret == 0) {  			fp->_flags |= __SERR;  			errno = EINVAL; -		} +		} else if (errret == ESPIPE) +			fp->_flags &= ~__SAPP;  		fp->_flags &= ~__SOFF;  		ret = -1;  	} else if (fp->_flags & __SOPT) { | 
