I'm working on a patch to fix unlink("file/") on Solaris 9. But as a prerequisite (to avoid anyone corrupting their file system if running the unit test as root, and accidentally unlinking an empty directory), I noticed that mingw failed to compile unlinkdir.c due to a missing geteuid. This works around it:
From: Eric Blake <e...@byu.net> Date: Wed, 16 Sep 2009 17:18:28 -0600 Subject: [PATCH] unlinkdir: port to mingw * m4/unlinkdir.m4 (gl_UNLINKDIR): Add mingw to list of platforms that refuse anyone to unlink a directory. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 6 ++++++ m4/unlinkdir.m4 | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff11ebe..1b30e94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-09-16 Eric Blake <e...@byu.net> + unlinkdir: port to mingw + * m4/unlinkdir.m4 (gl_UNLINKDIR): Add mingw to list of platforms + that refuse anyone to unlink a directory. + +2009-09-16 Eric Blake <e...@byu.net> + remove: new module * modules/remove: New file. * lib/remove.c: Likewise. diff --git a/m4/unlinkdir.m4 b/m4/unlinkdir.m4 index 0c84375..a8256d1 100644 --- a/m4/unlinkdir.m4 +++ b/m4/unlinkdir.m4 @@ -16,7 +16,7 @@ AC_DEFUN([gl_UNLINKDIR], AC_LIBOBJ([unlinkdir]) # The Hurd, the Linux kernel, the FreeBSD kernel version 2.2 and later, - # and Cygwin never let anyone (even root) unlink directories. + # Cygwin, and mingw never let anyone (even root) unlink directories. # If anyone knows of another system for which unlink can never # remove a directory, please report it to <bug-coreut...@gnu.org>. # Unfortunately this is difficult to test for, since it requires root access @@ -26,7 +26,8 @@ AC_DEFUN([gl_UNLINKDIR], *-*-gnu[[0-9]]* | \ *-*-linux-* | *-*-linux | \ *-*-freebsd2.2* | *-*-freebsd[[3-9]]* | *-*-freebsd[[1-9]][[0-9]]* | \ - *-cygwin) + *-cygwin | \ + *-mingw) AC_DEFINE([UNLINK_CANNOT_UNLINK_DIR], [1], [Define to 1 if unlink (dir) cannot possibly succeed.]);; esac -- 1.6.4.2