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>2009-06-18 13:47:13 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-06-18 13:47:13 +0400
commit1279c76b6a269ece36e057aeeb3e75d96f9efd56 (patch)
treeaee50590dbbdd5f777732b50a46fe5bd0e18e9ae
parente53c92a80e1d6acefdcbcf5e16f7f646971b2bef (diff)
* path.cc (chdir): Check error conditions first.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc10
2 files changed, 9 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4488c864d..3bee988c1 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-18 Corinna Vinschen <corinna@vinschen.de>
+
+ * path.cc (chdir): Check error conditions first.
+
2009-06-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::recv_internal): Mark WSARecvMsg
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 7477ac5c9..56bf6aece 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2575,7 +2575,11 @@ chdir (const char *in_dir)
bool doit = false;
const char *posix_cwd = NULL;
int devn = path.get_devn ();
- if (!isvirtual_dev (devn))
+ if (!path.exists ())
+ set_errno (ENOENT);
+ else if (!path.isdir ())
+ set_errno (ENOTDIR);
+ else if (!isvirtual_dev (devn))
{
/* The sequence chdir("xx"); chdir(".."); must be a noop if xx
is not a symlink. This is exploited by find.exe.
@@ -2587,10 +2591,6 @@ chdir (const char *in_dir)
res = 0;
doit = true;
}
- else if (!path.exists ())
- set_errno (ENOENT);
- else if (!path.isdir ())
- set_errno (ENOTDIR);
else
{
posix_cwd = path.normalized_path;