If I try to open an invalid TIFF file with TIFFOpen(), the function returns NULL. For some reason, the error handler isn't called. However, the file remains open, so I can't delete/overwrite it from the same process.
I tried using TIFFFdOpen(), so that I can close the handle myself, but for some reason it gives me this error on valid TIFFs: "Cannot read TIFF header". This time the error is passed via the error handler.
How can I solve either of these problems?
Update: I'm talking about problems in TIFFOpen() itself, not in functions called later on. For example, they might occur if the TIFF file has size zero.