diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index acf355b64..4ed1fa482 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2006-02-03 Christopher Faylor + + * dir.cc (mkdir): Reorganize check for trailing dot to return correct + error when directory exists. + * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Remove special + test for path ending in '.'. + 2006-02-03 Corinna Vinschen * path.cc (suffix_scan::lnk_match): Return true beginning with diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 0b588b5fc..0caf2df3a 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -265,12 +265,6 @@ mkdir (const char *dir, mode_t mode) if (efault.faulted (EFAULT)) return -1; - if (has_dot_last_component (dir)) - { - set_errno (ENOENT); - return -1; - } - if (!(fh = build_fh_name (dir, NULL, PC_SYM_NOFOLLOW))) goto done; /* errno already set */; @@ -279,6 +273,8 @@ mkdir (const char *dir, mode_t mode) 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 () ? EEXIST : ENOENT); else if (!fh->mkdir (mode)) res = 0; delete fh; diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index bc6fc3b31..be9d5128b 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1257,8 +1257,6 @@ fhandler_disk_file::mkdir (mode_t mode) #endif res = 0; } - else if (pc.exists ()) - set_errno (EEXIST); else __seterrno ();