summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2015-10-24 02:23:15 +0000
committerache <ache@FreeBSD.org>2015-10-24 02:23:15 +0000
commitd6852ac6f1dfc1396dee130993f8686cf53f5d2c (patch)
treec8f96d268fae59791f07df0c9f770053554f1f6a /lib/libc/stdio/stdio.c
parent9901e2ee18d8dffc84891f9ec0e7de37518bb95f (diff)
downloadFreeBSD-src-d6852ac6f1dfc1396dee130993f8686cf53f5d2c.zip
FreeBSD-src-d6852ac6f1dfc1396dee130993f8686cf53f5d2c.tar.gz
Since no room left in the _flags, reuse __SALC for O_APPEND.
It helps to remove _fcntl() call from _ftello() and optimize seek position calculation in _swrite(). MFC after: 3 weeks
Diffstat (limited to 'lib/libc/stdio/stdio.c')
-rw-r--r--lib/libc/stdio/stdio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c
index 44ee0ab..fc2e74b 100644
--- a/lib/libc/stdio/stdio.c
+++ b/lib/libc/stdio/stdio.c
@@ -117,7 +117,8 @@ _swrite(FILE *fp, char const *buf, int n)
ret = (*fp->_write)(fp->_cookie, buf, n);
/* __SOFF removed even on success in case O_APPEND mode is set. */
if (ret >= 0) {
- if ((fp->_flags & (__SAPP|__SOFF)) == (__SAPP|__SOFF) &&
+ /* XXX: Reuse __SALC for O_APPEND. */
+ if ((fp->_flags & __SOFF) && !(fp->_flags & __SALC) &&
fp->_offset <= OFF_MAX - ret)
fp->_offset += ret;
else
OpenPOWER on IntegriCloud