Re: psql -f doesn't complain about directories - Mailing list pgsql-hackers

From Tom Lane
Subject Re: psql -f doesn't complain about directories
Date
Msg-id 2876.1195141497@sss.pgh.pa.us
Whole thread Raw
In response to Re: psql -f doesn't complain about directories  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: psql -f doesn't complain about directories  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Am Mittwoch, 14. November 2007 schrieb Martijn van Oosterhout:
>> It's not the fopen that fails, it's the fgets that returns NULL. We
>> don't subsequently check if that's due to an I/O error or EISDIR or if
>> it's an end-of-file.

> Here is a patch for this.

This seems too far removed from the scene of the crime --- I don't have
a lot of confidence that errno will still be unchanged back in the main
loop.  I'd rather see the psql_error printout occur immediately after
the failed fgets call.  Either that or you need to be a bit more
proactive about ensuring errno is returned undamaged.

Also, I think you overlooked the case where we get a read error after
having already loaded some data into gets_fromFile's result buffer.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: LDC - Load Distributed Checkpoints with PG8.3b2 on Solaris
Next
From: Peter Eisentraut
Date:
Subject: Re: psql -f doesn't complain about directories