bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errno from open(<directory>) ?


From: Tim Rühsen
Subject: Re: errno from open(<directory>) ?
Date: Mon, 22 May 2017 21:30:56 +0200
User-agent: KMail/5.2.3 (Linux/4.9.0-3-amd64; KDE/5.28.0; x86_64; ; )

On Montag, 22. Mai 2017 08:00:14 CEST Paul Eggert wrote:
> On 05/22/2017 03:58 AM, Tim Rühsen wrote:
> > on GNU/Linux open() on a directory returns -1 and sets errno to EISDIR.
> 
> No, for example on my platform (Fedora 25 x86-64), 'strace cat .'
> outputs the line 'open(".", O_RDONLY) = 3'.

Same here on Debian unstable.
What you want to say is, that it depends on the flags.
And you are right, I wasn't very precise in that point.

Here we use
fd = open(fname, O_WRONLY | flag | O_CREAT | O_NONBLOCK | O_BINARY, S_IRUSR | 
S_IWUSR | S_IRGRP | S_IROTH);

'flag' might be one of O_TRUNC, O_APPEND or O_EXCL.

A test with different flags for open(<existing directory>) shows failure + 
errno EISDIR when opening for writing.

With Best Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]