Re: psql -f doesn't complain about directories

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql -f doesn't complain about directories
Date: 2007-11-15 15:44:57
Message-ID: 2876.1195141497@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2007-11-15 17:01:16 Re: psql -f doesn't complain about directories
Previous Message Alvaro Herrera 2007-11-15 15:24:39 Re: LDC - Load Distributed Checkpoints with PG8.3b2 on Solaris