From: Corinna Vinschen Date: Tue, 31 Aug 2010 13:48:04 +0000 (+0000) Subject: * path.cc (normalize_posix_path): Preserve //./ and //?/ prefixes. X-Git-Tag: binutils-2_21-branchpoint~141 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=274116ea120047e71abffc76dc41bcacab4f7a54;p=newlib-cygwin.git * path.cc (normalize_posix_path): Preserve //./ and //?/ prefixes. (path_conv::check): Allow access to root directory of native NT disk devices. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 82b5194ee..68465663c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2010-08-31 Corinna Vinschen + + * path.cc (normalize_posix_path): Preserve //./ and //?/ prefixes. + (path_conv::check): Allow access to root directory of native NT disk + devices. + 2010-08-31 Corinna Vinschen * include/cygwin/version.h: Bump DLL minor version number to 7. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f0cdbee1c..fe81acd8b 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -267,6 +267,14 @@ normalize_posix_path (const char *src, char *dst, char *&tail) { *tail++ = *src++; ++dst_start; + /* Is that a //?/ or //./ prefix into the native NT namespace? + If so, preserve it. */ + if ((src[1] == '.' || src[1] == '?') && isslash (src[2])) + { + *tail++ = *src++; + *tail++ = *src++; + dst_start += 2; + } } while (*src) @@ -818,6 +826,13 @@ path_conv::check (const char *src, unsigned opt, full_path[2] = '\\'; full_path[3] = '\0'; } + /* Otherwise, if the user requires a directory and explicitely + specified a path into the native NT namespace, add the trailing + backslash. It's needed to access the root dir. */ + else if (need_directory + && full_path[0] == '\\' && full_path[1] == '\\' + && (full_path[2] == '.' || full_path[2] == '?')) + strcat (full_path, "\\"); /* If the incoming path was given in DOS notation, always treat it as caseinsensitive,noacl path. This must be set before