Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-03-27 16:02:07 +0300
committerCorinna Vinschen <corinna@vinschen.de>2008-03-27 16:02:07 +0300
commit124d4c50103e42048dd76d0ab549de6bc216413b (patch)
treec82002aaf67751043dfeaefd34a2749e5f08abcb /winsup/cygwin/syscalls.cc
parente21ac1ebdba953f1a88d5630b9868a7a780eb144 (diff)
* syscalls.cc (rename): Fix setting errno in case of trailing "/."
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index d5f468344..eb3993d3d 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1497,10 +1497,16 @@ rename (const char *oldpath, const char *newpath)
if (efault.faulted (EFAULT))
return -1;
- if (has_dot_last_component (oldpath, true)
- || has_dot_last_component (newpath, true))
+ if (has_dot_last_component (oldpath, true))
{
- set_errno (EINVAL);
+ oldpc.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
+ set_errno (oldpc.isdir () ? EBUSY : ENOTDIR);
+ goto out;
+ }
+ if (has_dot_last_component (newpath, true))
+ {
+ newpc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
+ set_errno (!newpc.exists () ? ENOENT : newpc.isdir () ? EBUSY : ENOTDIR);
goto out;
}