]> granicus.if.org Git - python/commitdiff
Rather gross workaround for a bug in the mac GUSI I/O library:
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 10 Oct 2001 22:03:27 +0000 (22:03 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 10 Oct 2001 22:03:27 +0000 (22:03 +0000)
lseek(fp, 0L, SEEK_CUR) can make a filedescriptor unusable.
This workaround is expected to last only a few weeks (until GUSI
is fixed), but without it test_email fails.

Objects/fileobject.c

index 9a249aa61b74412224c458e67379ac8b98923fa5..8f903d1b467bf31f163f9a6224964b4e5ac1bae3 100644 (file)
@@ -523,9 +523,15 @@ new_buffersize(PyFileObject *f, size_t currentsize)
                   works.  We can't use the lseek() value either, because we
                   need to take the amount of buffered data into account.
                   (Yet another reason why stdio stinks. :-) */
+#ifdef USE_GUSI2
+               pos = lseek(fileno(f->f_fp), 1L, SEEK_CUR);
+               pos = lseek(fileno(f->f_fp), -1L, SEEK_CUR);
+#else
                pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR);
-               if (pos >= 0)
+#endif
+               if (pos >= 0) {
                        pos = ftell(f->f_fp);
+               }
                if (pos < 0)
                        clearerr(f->f_fp);
                if (end > pos && pos >= 0)