* path.cc (conv_path_list): Remove enclosing quotes and trailing
backslashes from Win32 environment path lists.
This commit is contained in:
parent
0e126cb141
commit
cecc445d5c
|
@ -1,3 +1,8 @@
|
||||||
|
2011-02-02 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* path.cc (conv_path_list): Remove enclosing quotes and trailing
|
||||||
|
backslashes from Win32 environment path lists.
|
||||||
|
|
||||||
2011-02-01 Christian Franke <franke@computer.org>
|
2011-02-01 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
|
* fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
|
||||||
|
|
|
@ -1351,17 +1351,35 @@ conv_path_list (const char *src, char *dst, size_t size, int to_posix)
|
||||||
bool saw_empty = false;
|
bool saw_empty = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char *s = strccpy (srcbuf, &src, src_delim);
|
char *srcpath = srcbuf;
|
||||||
size_t len = s - srcbuf;
|
char *s = strccpy (srcpath, &src, src_delim);
|
||||||
|
size_t len = s - srcpath;
|
||||||
if (len >= NT_MAX_PATH)
|
if (len >= NT_MAX_PATH)
|
||||||
{
|
{
|
||||||
err = ENAMETOOLONG;
|
err = ENAMETOOLONG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* Paths in Win32 path lists in the environment (%Path%), are often
|
||||||
|
enclosed in quotes (usually paths with spaces). Trailing backslashes
|
||||||
|
are common, too. Remove them. */
|
||||||
|
if (to_posix == ENV_CVT && len)
|
||||||
|
{
|
||||||
|
if (*srcpath == '"')
|
||||||
|
{
|
||||||
|
++srcpath;
|
||||||
|
*--s = '\0';
|
||||||
|
len -= 2;
|
||||||
|
}
|
||||||
|
while (len && s[-1] == '\\')
|
||||||
|
{
|
||||||
|
*--s = '\0';
|
||||||
|
--len;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
++d;
|
++d;
|
||||||
err = cygwin_conv_path (conv_fn, srcbuf, d, size - (d - dst));
|
err = cygwin_conv_path (conv_fn, srcpath, d, size - (d - dst));
|
||||||
}
|
}
|
||||||
else if (!to_posix)
|
else if (!to_posix)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue