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:
authorChristopher Faylor <me@cgf.cx>2001-11-24 06:35:58 +0300
committerChristopher Faylor <me@cgf.cx>2001-11-24 06:35:58 +0300
commit4e5289d84836889b172e4a31c76afb618f168b31 (patch)
treebc9d067dd6494fa681880ab6a0c6597799ea77e6
parentc7cf3563f0323153b364b7c95eedf67218ce3b26 (diff)
* path.cc (chdir): Allow 'cd /cygdrive'.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc19
2 files changed, 17 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9084ad9e6..3159fa2cb 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,9 @@
2001-11-23 Christopher Faylor <cgf@redhat.com>
+ * path.cc (chdir): Allow 'cd /cygdrive'.
+
+2001-11-23 Christopher Faylor <cgf@redhat.com>
+
* dtable.cc (dtable::vfork_parent_restore): Add debugging statement.
* exceptions.cc (try_to_debug): Spin only as long as we don't have a
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 6efdf7d9e..e818ed9fd 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3223,7 +3223,7 @@ chdir (const char *in_dir)
return -1;
}
- char *native_dir = path.get_win32 ();
+ const char *native_dir = path.get_win32 ();
/* Check to see if path translates to something like C:.
If it does, append a \ to the native directory specification to
@@ -3231,10 +3231,17 @@ chdir (const char *in_dir)
the last directory visited on the given drive. */
if (isdrive (native_dir) && !native_dir[2])
{
- native_dir[2] = '\\';
- native_dir[3] = '\0';
+ path.get_win32 ()[2] = '\\';
+ path.get_win32 ()[3] = '\0';
+ }
+ int res;
+ if (path.get_devn () != FH_CYGDRIVE)
+ res = SetCurrentDirectory (native_dir) ? 0 : -1;
+ else
+ {
+ native_dir = "c:\\";
+ res = 0;
}
- int res = SetCurrentDirectoryA (native_dir) ? 0 : -1;
/* If res < 0, we didn't change to a new directory.
Otherwise, set the current windows and posix directory cache from input.
@@ -3250,9 +3257,9 @@ chdir (const char *in_dir)
__seterrno ();
else if (!path.has_symlinks () && strpbrk (dir, ":\\") == NULL
&& pcheck_case == PCHECK_RELAXED)
- cygheap->cwd.set (path, dir);
+ cygheap->cwd.set (native_dir, dir);
else
- cygheap->cwd.set (path, NULL);
+ cygheap->cwd.set (native_dir, NULL);
/* Note that we're accessing cwd.posix without a lock here. I didn't think
it was worth locking just for strace. */