diff options
Diffstat (limited to 'src/stdio/fseek.c')
-rw-r--r-- | src/stdio/fseek.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/fseek.c b/src/stdio/fseek.c index 67d75f7a..439308f7 100644 --- a/src/stdio/fseek.c +++ b/src/stdio/fseek.c @@ -3,10 +3,10 @@ int __fseeko_unlocked(FILE *f, off_t off, int whence) { /* Adjust relative offset for unread data in buffer, if any. */ - if (whence == SEEK_CUR) off -= f->rend - f->rpos; + if (whence == SEEK_CUR && f->rend) off -= f->rend - f->rpos; /* Flush write buffer, and report error on failure. */ - if (f->wpos > f->wbase) { + if (f->wpos != f->wbase) { f->write(f, 0, 0); if (!f->wpos) return -1; } |