From deeffc5036c2a88c6e36b5c409714ff65e30b6e9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 27 Jan 2012 09:28:38 +0000 Subject: [PATCH] * dcrt0.cc (is_dos_path): New macro to recognize drive letter and UNC DOS paths. (globify): Call is_dos_path instead of isdrive. --- winsup/cygwin/ChangeLog | 7 ++++--- winsup/cygwin/dcrt0.cc | 12 ++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9003621fc..b51c18ea2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,7 +1,8 @@ -2012-01-26 Christopher Faylor +2012-01-27 Corinna Vinschen - * sigproc.cc (child_info::retry_count): Actually that should have been - 0. + * dcrt0.cc (is_dos_path): New macro to recognize drive letter and UNC + DOS paths. + (globify): Call is_dos_path instead of isdrive. 2012-01-26 Christopher Faylor diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 827ab143d..5cee5f16d 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -194,6 +194,14 @@ quoted (char *cmd, int winshell) /* Perform a glob on word if it contains wildcard characters. Also quote every character between quotes to force glob to treat the characters literally. */ + +/* Either X:[...] or \\server\[...] */ +#define is_dos_path(s) (isdrive(s) \ + || ((s)[0] == '\\' \ + && (s)[1] == '\\' \ + && isalpha ((s)[2]) \ + && strchr ((s) + 3, '\\'))) + static int __stdcall globify (char *word, char **&argv, int &argc, int &argvlen) { @@ -202,9 +210,9 @@ globify (char *word, char **&argv, int &argc, int &argvlen) int n = 0; char *p, *s; - int dos_spec = isdrive (word); + int dos_spec = is_dos_path (word); if (!dos_spec && isquote (*word) && word[1] && word[2]) - dos_spec = isdrive (word + 1); + dos_spec = is_dos_path (word + 1); /* We'll need more space if there are quoting characters in word. If that is the case, doubling the size of the