aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-10-29 01:15:12 +0000
committerChristopher Faylor <me@cgf.cx>2003-10-29 01:15:12 +0000
commit7825ed016ffa071b785a65dba6144e3bd53abf04 (patch)
treefd3824e19c66732ac8a55d8dcb7a90aa0aa5249e
parenta4666b3d1b4c817393838c47be1cf3d1a5be4b95 (diff)
downloadnewlib-7825ed016ffa071b785a65dba6144e3bd53abf04.zip
newlib-7825ed016ffa071b785a65dba6144e3bd53abf04.tar.gz
newlib-7825ed016ffa071b785a65dba6144e3bd53abf04.tar.bz2
* path.cc (dot_special_chars): New global variable.
(special_name): Make files ending in "." special. (fnunmunge): Allow encoded ".". (mount_item::fnmunge): Handle trailing ".".
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/path.cc17
2 files changed, 22 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 746247e..f152be8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2003-10-28 Igor Pechtchanski <pechtcha@cs.nyu.edu>
+
+ * path.cc (dot_special_chars): New global variable.
+ (special_name): Make files ending in "." special.
+ (fnunmunge): Allow encoded ".".
+ (mount_item::fnmunge): Handle trailing ".".
+
2003-10-28 Christopher Faylor <cgf@redhat.com>
* include/stdint.h: Duplicate below effort for rest of *64_*.
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b759d61..499ccd0 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1141,7 +1141,8 @@ set_flags (unsigned *flags, unsigned val)
}
}
-static char special_chars[] =
+static char dot_special_chars[] =
+ "."
"\001" "\002" "\003" "\004" "\005" "\006" "\007" "\010"
"\011" "\012" "\013" "\014" "\015" "\016" "\017" "\020"
"\021" "\022" "\023" "\024" "\025" "\026" "\027" "\030"
@@ -1151,6 +1152,7 @@ static char special_chars[] =
"I" "J" "K" "L" "M" "N" "O" "P"
"Q" "R" "S" "T" "U" "V" "W" "X"
"Y" "Z";
+static char *special_chars = dot_special_chars + 1;
static char special_introducers[] =
"anpcl";
@@ -1178,6 +1180,11 @@ special_name (const char *s, int inc = 1)
if (strpbrk (s, special_chars))
return !strncasematch (s, "%2f", 3);
+ if (strcasematch (s, ".") || strcasematch (s, ".."))
+ return false;
+ if (s[strlen (s)-1] == '.')
+ return true;
+
const char *p;
if (strcasematch (s, "conin$") || strcasematch (s, "conout$"))
return -1;
@@ -1212,7 +1219,7 @@ fnunmunge (char *dst, const char *src)
}
while (*src)
- if (!(c = special_char (src)))
+ if (!(c = special_char (src, dot_special_chars)))
*dst++ = *src++;
else
{
@@ -1243,6 +1250,12 @@ mount_item::fnmunge (char *dst, const char *src)
*d++ = *src++;
else
d += __small_sprintf (d, "%%%02x", (unsigned char) *src++);
+
+ if (*--d != '.')
+ d++;
+ else
+ d += __small_sprintf (d, "%%%02x", (unsigned char) '.');
+
*d = *src;
}