[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rmdir errno cleanup
From: |
Eric Blake |
Subject: |
rmdir errno cleanup |
Date: |
Wed, 16 Sep 2009 14:32:48 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
OK to commit this? POSIX allows rmdir("non-empty-dir") to fail with either
ENOTEMPTY (Linux) or EEXIST (Solaris). But the gnulib module rmdir-errno
blindly assumes ENOTEMPTY during cross-compilation; it seems like we could be
safer by listing both cases explicitly, rather than risking a failed cross-
compilation to Solaris.
Meanwhile, I will be un-obsoleting the gnulib module rmdir, to work around a
cygwin 1.5.x bug where rmdir("empty/.") correctly fails, but rmdir("empty/./")
accidently removes "empty".
From: Eric Blake <address@hidden>
Date: Wed, 16 Sep 2009 08:27:07 -0600
Subject: [PATCH] rm, rmdir: improve cross-compilation support
* bootstrap.conf (gnulib_modules): Drop rmdir-errno.
* src/rmdir.c (errno_rmdir_non_empty): Check both cases allowed by
POSIX, rather than relying on configure-time check that might
fail during cross-compilation. Reverts commit 9b6eb98d41.
---
bootstrap.conf | 1 -
src/rmdir.c | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 9cdfb79..fb5ed15 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -179,7 +179,6 @@ gnulib_modules="
regex
rename-dest-slash
rmdir
- rmdir-errno
root-dev-ino
rpmatch
safe-read
diff --git a/src/rmdir.c b/src/rmdir.c
index 3bfff22..826cebc 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -74,7 +74,7 @@ static struct option const longopts[] =
static bool
errno_rmdir_non_empty (int error_number)
{
- return (error_number == RMDIR_ERRNO_NOT_EMPTY);
+ return error_number == ENOTEMPTY || error_number == EEXIST;
}
/* Return true if when rmdir fails with errno == ERROR_NUMBER
--
1.6.4.2
- rmdir errno cleanup,
Eric Blake <=