This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libio backward compat bug? involving setmntent()


> 
> On Tue, 13 Apr 1999 07:48:56 -0700 (PDT), H.J. Lu wrote:
> >> 
> >> 
> >> The appended slightly-out-of-spec code segfaults when compiled on a
> >> libc 2.0 system and run on a libc 2.1 system.  The problem is that
> >> setmntent() returns a new FILE*, but fclose is bound to the old
> >> fclose.
> >> 
> >> Do we want to support this, and if so, how?  (Have old fclose
> >> recognize when it's handed a new FILE* and call _IO_new_fclose?)
> >> 
> >
> >Thanks for the bug report. I will fix it.
> 
> Try this patch for size.
> 
> zw
> 
> 1999-04-13 10:52 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>
> 
> 	* libio/libio.h: Define _IO_NEW_MAGIC.
> 	* libio/libioP.h: Define IS_NEW_FILE.  In debugging
> 	CHECK_FILE, permit either _IO_MAGIC or _IO_NEW_MAGIC.  If not
> 	_IO_USE_OLD_IO_FILE, use _IO_NEW_MAGIC in FILEBUF_LITERAL.
> 	* libio/oldiofclose.c (_IO_old_fclose): If IS_NEW_FILE(fp),
> 	hand off to _IO_new_fclose.
> 
> 	* libio/fileops.c (_IO_file_close_it): Use _IO_NEW_MAGIC.
> 	* libio/genops.c (_IO_init): Likewise.
> 	* libio/oldiofdopen.c (_IO_old_fdopen): After calling
> 	_IO_init, reset magic to _IO_MAGIC.
> 	* libio/oldiofopen.c (_IO_old_fopen): Likewise.
> 	* libio/oldiopopen.c (_IO_old_popen): Likewise.
> 

I like this approach. But on the other hand, libio is used
by both glibc and libstdc++. I am not sure introducing
_IO_NEW_MAGIC is a good idea or not. As least, you may have
to change libstdc++ to match it.

Ulrich, do you want to use this one or should I make a patch
to use the old approach with __old_setmntent/__old_endmntent
and other functions?


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]