]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Ugly band-aid to work around a bug in Linux ftell().
authorGuido van Rossum <guido@python.org>
Tue, 5 May 1998 22:21:35 +0000 (22:21 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 5 May 1998 22:21:35 +0000 (22:21 +0000)
Objects/fileobject.c

index 76f5318f51b5b6712e60c1d9533a07ad991c717b..d43f113ea8cf6fb8ab47c4f34c12545b3cacf277 100644 (file)
@@ -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)