musl/src/internal
Rich Felker 3af2edee15 fix ftello result for append streams with unflushed output
when there is unflushed output, ftello (and ftell) compute the logical
stream position as the underlying file descriptor's offset plus an
adjustment for the amount of buffered data. however, this can give the
wrong result for append-mode streams where the unflushed writes should
adjust the logical position to be at the end of the file, as if a seek
to end-of-file takes place before the write.

the solution turns out to be a simple trick: when ftello (indirectly)
calls lseek to determine the current file offset, use SEEK_END instead
of SEEK_CUR if the stream is append-mode and there's unwritten
buffered data.

the ISO C rules regarding switching between reading and writing for a
stream opened in an update mode, along with the POSIX rules regarding
switching "active handles", conveniently leave undefined the
hypothetical usage cases where this fix might lead to observably
incorrect offsets.

the bug being fixed was discovered via the test case for glibc issue
2014-02-07 00:57:50 -05:00
..
arm initial commit of the arm port 2011-09-18 16:44:54 -04:00
i386 fix clobber of edx in i386 vsyscall asm 2012-11-11 13:56:37 -05:00
microblaze microblaze port 2012-09-29 01:05:31 -04:00
mips add 7-arg syscall support for mips 2012-09-09 14:53:06 -04:00
powerpc PPC port cleaned up, static linking works well now. 2012-11-13 19:12:25 +01:00
x86_64 restore use of .type in asm, but use modern @function (vs %function) 2011-06-14 23:15:08 -04:00
floatscan.c clean up stdio_impl.h 2012-11-08 16:39:41 -05:00
floatscan.h fix really bad breakage in strtol, etc.: failure to accept leading spaces 2012-04-19 12:47:34 -04:00
futex.h unify and overhaul timed futex waits 2011-08-02 21:11:36 -04:00
intscan.c clean up stdio_impl.h 2012-11-08 16:39:41 -05:00
intscan.h new scanf implementation and corresponding integer parser/converter 2012-04-16 16:03:45 -04:00
ksigaction.h add some comments about the mips ksigaction structure weirdness 2013-06-29 12:24:06 -04:00
libc.c add support for program_invocation[_short]_name 2013-04-06 17:50:37 -04:00
libc.h fix potential deadlock bug in libc-internal locking logic 2013-09-20 02:00:27 -04:00
libm.h math: remove STRICT_ASSIGN macro 2013-09-06 18:35:55 +00:00
locale_impl.h refactor headers, especially alltypes.h, and improve C++ ABI compat 2013-07-22 11:22:36 -04:00
procfdname.c debloat code that depends on /proc/self/fd/%d with shared function 2013-08-02 12:59:45 -04:00
pthread_impl.h fix multiple bugs in SIGEV_THREAD timers 2013-08-03 13:20:42 -04:00
shgetc.c fix major scanf breakage with unbuffered streams, fmemopen, etc. 2013-06-22 17:11:17 -04:00
shgetc.h fix broken shgetc limiter logic (wasn't working) 2012-04-16 01:55:37 -04:00
stdio_impl.h fix ftello result for append streams with unflushed output 2014-02-07 00:57:50 -05:00
syscall.c overhaul syscall interface 2011-03-19 18:51:42 -04:00
syscall.h fix missing argument in variadic syscall macros 2013-07-17 10:43:04 -04:00
syscall_ret.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
version.c add infrastructure to record and report the version of libc.so 2013-12-01 17:27:25 -05:00