aboutsummaryrefslogtreecommitdiff
path: root/libio/fileops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index e0d7b76eda..dca359179f 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -943,15 +943,14 @@ do_ftell (_IO_FILE *fp)
yet. */
if (fp->_IO_buf_base != NULL)
{
- bool was_writing = (fp->_IO_write_ptr > fp->_IO_write_base
- || _IO_in_put_mode (fp));
+ bool unflushed_writes = fp->_IO_write_ptr > fp->_IO_write_base;
bool append_mode = (fp->_flags & _IO_IS_APPENDING) == _IO_IS_APPENDING;
/* When we have unflushed writes in append mode, seek to the end of the
file and record that offset. This is the only time we change the file
stream state and it is safe since the file handle is active. */
- if (was_writing && append_mode)
+ if (unflushed_writes && append_mode)
{
result = _IO_SYSSEEK (fp, 0, _IO_seek_end);
if (result == _IO_pos_BAD)
@@ -961,7 +960,7 @@ do_ftell (_IO_FILE *fp)
}
/* Adjust for unflushed data. */
- if (!was_writing)
+ if (!unflushed_writes)
offset -= fp->_IO_read_end - fp->_IO_read_ptr;
/* We don't trust _IO_read_end to represent the current file offset when
writing in append mode because the value would have to be shifted to