summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fopen.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/fopen.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/fopen.c')
-rw-r--r--lib/libc/stdio/fopen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c
index b08e336..b26f637 100644
--- a/lib/libc/stdio/fopen.c
+++ b/lib/libc/stdio/fopen.c
@@ -91,7 +91,10 @@ fopen(const char * __restrict file, const char * __restrict mode)
* we can do about this. (We could set __SAPP and check in
* fseek and ftell.)
*/
- if (oflags & O_APPEND)
+ if (oflags & O_APPEND) {
+ /* XXX: Reuse __SALC for O_APPEND. */
+ fp->_flags |= __SALC;
(void)_sseek(fp, (fpos_t)0, SEEK_END);
+ }
return (fp);
}
OpenPOWER on IntegriCloud