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 ?


With Best Regards, Tim


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to