IO_DEBUG in libio/Makefile

Andreas Schwab schwab@issan.informatik.uni-dortmund.de
Thu Apr 8 01:29:00 GMT 1999


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



More information about the Libc-hacker mailing list