diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-06-18 09:47:13 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-06-18 09:47:13 +0000 |
commit | 1279c76b6a269ece36e057aeeb3e75d96f9efd56 (patch) | |
tree | aee50590dbbdd5f777732b50a46fe5bd0e18e9ae /winsup/cygwin/path.cc | |
parent | e53c92a80e1d6acefdcbcf5e16f7f646971b2bef (diff) | |
download | cygnal-1279c76b6a269ece36e057aeeb3e75d96f9efd56.tar.gz cygnal-1279c76b6a269ece36e057aeeb3e75d96f9efd56.tar.bz2 cygnal-1279c76b6a269ece36e057aeeb3e75d96f9efd56.zip |
* path.cc (chdir): Check error conditions first.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 10 |
1 files changed, 5 insertions, 5 deletions
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; |