From 25bafd7b0e256c128c9bbbcfa5342f9d84ff08e3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 4 Feb 2006 19:02:42 +0000 Subject: [PATCH] * dir.cc (rmdir): Reorganize check for trailing dot to return correct error when directory does not exist. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/dir.cc | 9 +++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4ed1fa482..b064f20a8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2006-02-04 Christopher Faylor + + * dir.cc (rmdir): Reorganize check for trailing dot to return correct + error when directory does not exist. + 2006-02-03 Christopher Faylor * dir.cc (mkdir): Reorganize check for trailing dot to return correct diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 0caf2df3a..eb357cd02 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -295,12 +295,6 @@ rmdir (const char *dir) if (efault.faulted (EFAULT)) return -1; - if (has_dot_last_component (dir)) - { - set_errno (EINVAL); - return -1; - } - if (!(fh = build_fh_name (dir, NULL, PC_SYM_NOFOLLOW))) goto done; /* errno already set */; @@ -309,8 +303,11 @@ rmdir (const char *dir) debug_printf ("got %d error from build_fh_name", fh->error ()); set_errno (fh->error ()); } + else if (has_dot_last_component (dir)) + set_errno (fh->exists () ? EINVAL : ENOENT); else if (!fh->rmdir ()) res = 0; + delete fh; done: