summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-03-20 08:37:44 +0100
committerBruno Haible <bruno@clisp.org>2018-03-20 08:40:53 +0100
commit66ae2f356a594c83ad690d0dfadbc9c9a4cec5f4 (patch)
tree99f12c0f3b5cff2e3f7e85190ad12a5646539fb1 /lib
parent206a83e475bafbc46352cd92af6065d5d14395bb (diff)
downloadgnulib-66ae2f356a594c83ad690d0dfadbc9c9a4cec5f4.tar.gz
euidaccess: Port to native Windows.
* lib/euidaccess.c (euidaccess): On native Windows, just use _access(). * posix-modules (exclude_for_mingw): Remove 'euidaccess'.
Diffstat (limited to 'lib')
-rw-r--r--lib/euidaccess.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index aee693571c..4f512f5af5 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -29,8 +29,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-
-#include "root-uid.h"
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <io.h>
+#else
+# include "root-uid.h"
+#endif
#if HAVE_LIBGEN_H
# include <libgen.h>
@@ -84,7 +87,9 @@ euidaccess (const char *file, int mode)
return accessx (file, mode, ACC_SELF);
#elif HAVE_EACCESS /* FreeBSD */
return eaccess (file, mode);
-#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, mingw, BeOS */
+#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* mingw */
+ return _access (file, mode);
+#else /* Mac OS X, NetBSD, OpenBSD, HP-UX, Solaris, Cygwin, BeOS */
uid_t uid = getuid ();
gid_t gid = getgid ();