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: IO_DEBUG in libio/Makefile


Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:

|> PR libc/1069 reported a problem with a call to fseek on a non-opened
|> filehandle.  The program worked when statically linked but fails
|> dynamically linked.  Jon Sherling pointed out that this results from
|> different definitions for CHECK_FILE in libio/libioP.h.  Only with
|> IO_DEBUG set (which is set for the static library), a test function is
|> used to check the FILE handle.
|> 
|> Is this really intented?  Shouldn't IO_DEBUG always be off - and
|> perhaps switched on only in some special debugging library ?

First of all, using a closed stdio filehandle in any way is a big no-no.
Jon's program does not work at all, it is just broken, and crashing is a
completely adequate outcome.  And IO_DEBUG isn't even effective here
because it accesses memory that has already been freed, thus it can crash
as well.  So i'd agree that it should be removed.

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


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