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
signature.asc
Description: This is a digitally signed message part.