From d6852ac6f1dfc1396dee130993f8686cf53f5d2c Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 24 Oct 2015 02:23:15 +0000 Subject: 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 --- lib/libc/stdio/fdopen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdio/fdopen.c') diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c index b936998..8bd9c2d 100644 --- a/lib/libc/stdio/fdopen.c +++ b/lib/libc/stdio/fdopen.c @@ -91,7 +91,10 @@ fdopen(int fd, const char *mode) * O_APPEND bit set, assert __SAPP so that __swrite() caller * will _sseek() to the end before write. */ - if ((oflags & O_APPEND) && !(fdflags & O_APPEND)) + /* XXX: Reuse __SALC for O_APPEND. */ + if (fdflags & O_APPEND) + fp->_flags |= __SALC; + else if (oflags & O_APPEND) fp->_flags |= __SAPP; fp->_file = fd; fp->_cookie = fp; -- cgit v1.1