summaryrefslogtreecommitdiff
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
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'.
-rw-r--r--ChangeLog6
-rw-r--r--lib/euidaccess.c11
-rwxr-xr-xposix-modules2
3 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bbe99989e..9b8653f782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-20 Bruno Haible <bruno@clisp.org>
+
+ euidaccess: Port to native Windows.
+ * lib/euidaccess.c (euidaccess): On native Windows, just use _access().
+ * posix-modules (exclude_for_mingw): Remove 'euidaccess'.
+
2018-03-19 Bruno Haible <bruno@clisp.org>
javacomp: Add support for Java 7, 8, 9.
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 ();
diff --git a/posix-modules b/posix-modules
index 5d16d26a15..9315e757b4 100755
--- a/posix-modules
+++ b/posix-modules
@@ -227,7 +227,7 @@ exclude_for_mingw=
# <grp.h> does not exist.
exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt"
# The functions getuid, getgid, geteuid, getegid don't exist.
-exclude_for_mingw="$exclude_for_mingw euidaccess faccessat"
+exclude_for_mingw="$exclude_for_mingw faccessat"
exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat"
# Excludes for MSVC.