diff options
author | Guido van Rossum <guido@python.org> | 1998-05-05 22:21:35 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-05-05 22:21:35 (GMT) |
commit | 91aaa92c888c8f1c026241d2306a01b6f2ecd1c5 (patch) | |
tree | d47a77fef8af78c85aff2911c9bce660e4b746e1 /Objects/fileobject.c | |
parent | a58153e8bfb0f6a20403e487d499ee913d51d679 (diff) | |
download | cpython-91aaa92c888c8f1c026241d2306a01b6f2ecd1c5.zip cpython-91aaa92c888c8f1c026241d2306a01b6f2ecd1c5.tar.gz cpython-91aaa92c888c8f1c026241d2306a01b6f2ecd1c5.tar.bz2 |
Ugly band-aid to work around a bug in Linux ftell().
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 76f5318..d43f113 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -421,7 +421,9 @@ new_buffersize(f, currentsize) struct stat st; if (fstat(fileno(f->f_fp), &st) == 0) { end = st.st_size; - pos = ftell(f->f_fp); + pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR); + if (pos >= 0) + pos = ftell(f->f_fp); if (pos < 0) clearerr(f->f_fp); if (end > pos && pos >= 0) |