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>2005-09-29 20:23:22 +0400
committerCorinna Vinschen <corinna@vinschen.de>2005-09-29 20:23:22 +0400
commitf6c9ff6646a97ad4dd45ebdf755d4eb73fe5b6a5 (patch)
treead572005626fe141e487dc98b783921d9d0d3854 /winsup/cygwin/dir.cc
parent9a7b0aad2ade1e0f3d0450118861d7bc52f344c0 (diff)
* dir.cc (mkdir): Check for trailing /. or /.. component.
(rmdir): Ditto. * path.cc (has_dot_last_component): New function. * path.h (has_dot_last_component): Add declaration.
Diffstat (limited to 'winsup/cygwin/dir.cc')
-rw-r--r--winsup/cygwin/dir.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index bbb4ca17f..c6b318edd 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -255,6 +255,16 @@ mkdir (const char *dir, mode_t mode)
int res = -1;
fhandler_base *fh = NULL;
+ myfault efault;
+ 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 | PC_WRITABLE)))
goto done; /* errno already set */;
@@ -279,6 +289,16 @@ rmdir (const char *dir)
int res = -1;
fhandler_base *fh = NULL;
+ myfault efault;
+ 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 | PC_WRITABLE)))
goto done; /* errno already set */;