Re: psql -f doesn't complain about directories

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql -f doesn't complain about directories
Date: 2007-11-14 20:33:17
Message-ID: 473B5B8D.6010801@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout wrote:
> On Wed, Nov 14, 2007 at 05:15:20PM -0300, Alvaro Herrera wrote:
>>> Should we do some kind of stat() before opening the file and abort if it's a
>>> directory?
>> Actually anything other than a plain file, right? (Do we really want to
>> be able to psql -f a_pipe?)
>
> Sure, why not. To be honest I think that psql shouldn't be ignoring the
> EISDIR error the kernel is returning.

But it works when you open directory in read-only mode. See posix
definition:

[EISDIR]
The named file is a directory and oflag includes O_WRONLY or O_RDWR.

Zdenek

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2007-11-14 20:34:40 Re: psql -f doesn't complain about directories
Previous Message Martijn van Oosterhout 2007-11-14 20:19:41 Re: psql -f doesn't complain about directories