* path.cc (chdir): Eat trailing whitespace on input path.

This commit is contained in:
Christopher Faylor 2001-03-29 00:30:39 +00:00
parent 1ac6d1a144
commit b5eb3d0f15
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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);