summaryrefslogtreecommitdiff
path: root/libc/stdio/ftello.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2006-12-06 22:41:21 +0000
committerEric Andersen <andersen@codepoet.org>2006-12-06 22:41:21 +0000
commit99d6c367c4820a072dc4ada51561df17e2093778 (patch)
tree969945da0bce7248de98eefedaeb590f5cfdd85e /libc/stdio/ftello.c
parentaeba32a371882d602f6863320880f0c69c824b77 (diff)
stdio update from mjn3
Diffstat (limited to 'libc/stdio/ftello.c')
-rw-r--r--libc/stdio/ftello.c5
1 files changed, 4 insertions, 1 deletions
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;
}