aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-12-27 18:10:49 +0000
committerCorinna Vinschen <corinna@vinschen.de>2005-12-27 18:10:49 +0000
commit9e68bb7b50888ba3ff1c2bbcef78e6f6c9f1b4a0 (patch)
tree9998356dfe4d013ff7dce82ff69d821af33c98b0 /winsup/cygwin/path.cc
parent22d7108ee5dbd881a6d48855d6de2e425a4d5e3e (diff)
downloadnewlib-9e68bb7b50888ba3ff1c2bbcef78e6f6c9f1b4a0.zip
newlib-9e68bb7b50888ba3ff1c2bbcef78e6f6c9f1b4a0.tar.gz
newlib-9e68bb7b50888ba3ff1c2bbcef78e6f6c9f1b4a0.tar.bz2
* path.cc (path_conv::check): Rework loop removing trailing dots
and spaces. * syslog.cc (vklog): Set facility to LOG_KERN if not set.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index f2b56cf..8fc616e 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -955,18 +955,26 @@ out:
{
if (strncmp (path, "\\\\.\\", 4))
{
- /* Windows ignores trailing dots and spaces */
+ /* Windows ignores trailing dots and spaces in the last path
+ component, and ignores exactly one trailing dot in inner
+ path components. */
char *tail = NULL;
for (char *p = path; *p; p++)
- if (*p != '.' && *p != ' ')
- tail = NULL;
- else if (p[1] == '\\')
- {
- memmove (p, p + 1, strlen (p));
+ {
+ if (*p != '.' && *p != ' ')
tail = NULL;
- }
- else if (!tail)
- tail = p;
+ else if (!tail)
+ tail = p;
+ if (tail && p[1] == '\\')
+ {
+ if (p > tail || *tail != '.')
+ {
+ error = ENOENT;
+ return;
+ }
+ tail = NULL;
+ }
+ }
if (!tail || tail == path)
/* nothing */;