aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc8
2 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7f053fb..451bc76 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+Wed Mar 28 19:28:50 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (chdir): Eat trailing whitespace on input path.
+
Tue Mar 27 22:38:42 2001 Christopher Faylor <cgf@cygnus.com>
* lib/_cygwin_S_IEXEC.c: Remove "const" from globals or they never seem
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b95182d..ff89eb4 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2742,6 +2742,14 @@ chdir (const char *dir)
syscall_printf ("dir %s", dir);
path_conv path (dir, PC_FULL | PC_SYM_FOLLOW);
+ char *s;
+ /* Incredibly. Windows allows you to specify a path with trailing
+ whitespace to SetCurrentDirectory. This doesn't work too well
+ with other parts of the API, though, apparently. So nuke trailing
+ white space. */
+ for (s = strchr (dir, '\0'); --s >= dir && isspace (*s); )
+ *s = '\0';
+
if (path.error)
{
set_errno (path.error);