diff options
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index b95182d66..ff89eb4ff 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); |