From 99d6c367c4820a072dc4ada51561df17e2093778 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 6 Dec 2006 22:41:21 +0000 Subject: stdio update from mjn3 --- libc/stdio/ftello.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libc/stdio/ftello.c') diff --git a/libc/stdio/ftello.c b/libc/stdio/ftello.c index 4445471a4..bae1d877c 100644 --- a/libc/stdio/ftello.c +++ b/libc/stdio/ftello.c @@ -39,7 +39,10 @@ OFFSET_TYPE FTELL(register FILE *stream) __STDIO_STREAM_VALIDATE(stream); - if ((__SEEK(stream, &pos, SEEK_CUR) < 0) + if ((__SEEK(stream, &pos, + ((__STDIO_STREAM_IS_WRITING(stream) + && (stream->__modeflags & __FLAG_APPEND)) + ? SEEK_END : SEEK_CUR)) < 0) || (__stdio_adjust_position(stream, &pos) < 0)) { pos = -1; } -- cgit v1.2.3