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 13:02:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/22/2017 12:58 PM, Tim Rühsen wrote:
> Hi,
> 
> on GNU/Linux open() on a directory returns -1 and sets errno to EISDIR.
> 
> Built on MinGW / Win32 the same open sets errno to EACCES.
> 
> 
> We currently use a work-around like
> +     int rc = open(pathname, flags, mode);
> +#ifdef _WIN32
> +     if (rc < 0 && errno == EACCES) {
> +             DWORD attrs = GetFileAttributes(pathname);
> +             if (attrs & FILE_ATTRIBUTE_DIRECTORY)
> +                     errno = EISDIR;
> +     }
> +#endif
> 
> Could you consider to adjust the behavior of gnulib's open() similarly,
> or is there any reason against it ?

And if you apply something like that, please be so kind and mention
Akash Rawal, one of our GSOC students who came up with this code.

With Best Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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