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/freopen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libc/stdio/freopen.c') diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 4dcd50f..8b68bac 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -240,8 +240,11 @@ finish: * 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); + } FUNLOCKFILE(fp); return (fp); } -- cgit v1.1