[Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.132,2.133

Jack Jansen jackjansen@users.sourceforge.net
Wed, 10 Oct 2001 15:03:29 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv26029/Python/Objects

Modified Files:
	fileobject.c 
Log Message:
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.

Index: fileobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v
retrieving revision 2.132
retrieving revision 2.133
diff -C2 -d -r2.132 -r2.133
*** fileobject.c	2001/10/05 20:51:38	2.132
--- fileobject.c	2001/10/10 22:03:27	2.133
***************
*** 524,530 ****
  		   need to take the amount of buffered data into account.
  		   (Yet another reason why stdio stinks. :-) */
  		pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR);
! 		if (pos >= 0)
  			pos = ftell(f->f_fp);
  		if (pos < 0)
  			clearerr(f->f_fp);
--- 524,536 ----
  		   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);
! #endif
! 		if (pos >= 0) {
  			pos = ftell(f->f_fp);
+ 		}
  		if (pos < 0)
  			clearerr(f->f_fp);