diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-10-10 22:03:27 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-10-10 22:03:27 (GMT) |
commit | 2771b5b52b3ed7a64c9e7c820518c9266915958b (patch) | |
tree | 9715d2cf2ce6c1663b092dfc3a90aca91d6ab803 | |
parent | b088dd4a2691fc336e727d271ade456523ad7270 (diff) | |
download | cpython-2771b5b52b3ed7a64c9e7c820518c9266915958b.zip cpython-2771b5b52b3ed7a64c9e7c820518c9266915958b.tar.gz cpython-2771b5b52b3ed7a64c9e7c820518c9266915958b.tar.bz2 |
Rather gross workaround for a bug in the mac GUSI I/O library:
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.
-rw-r--r-- | Objects/fileobject.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 9a249aa..8f903d1 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -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) |