+2009-05-28 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * path.cc (cwdstuff::set): Avoid removing a nonexistent trailing slash.
+
2009-05-20 Eric Blake <ebb9@byu.net>
* net.cc (gethostby_helper): Use correct signedness.
const char *cygwin_inet_ntop (int, const void *, char *, socklen_t);
int dn_length1(const unsigned char *, const unsigned char *,
const unsigned char *);
-
} /* End of "C" section */
const struct in6_addr in6addr_any = {{IN6ADDR_ANY_INIT}};
else
res = (i & IN_CLASSC_NET) >> IN_CLASSC_NSHIFT;
-
return res;
}
pdir->Length + 2);
RtlCopyUnicodeString (&win32, pdir);
RtlReleasePebLock ();
- /* Remove trailing slash. */
- if (win32.Length > 3 * sizeof (WCHAR))
+ /* Remove trailing slash if one exists. FIXME: Is there a better way to
+ do this? */
+ if (win32.Length > 3 * sizeof (WCHAR) && win32.Buffer[win32.Length - 1] == L'\\')
win32.Length -= sizeof (WCHAR);
posix_cwd = NULL;
}
upath.Buffer[0] = L'\\';
upath.Length = len * sizeof (WCHAR);
}
- else if (upath.Length > 3 * sizeof (WCHAR))
- upath.Length -= sizeof (WCHAR); /* Strip trailing backslash */
+ /* Remove trailing slash if one exists. FIXME: Is there a better way to
+ do this? */
+ else if (upath.Length > 3 * sizeof (WCHAR) && upath.Buffer[upath.Length] == L'\\')
+ upath.Length -= sizeof (WCHAR);
RtlInitEmptyUnicodeString (&win32,
(PWCHAR) crealloc_abort (win32.Buffer,
upath.Length + 2),
upath.Length + 2);
RtlCopyUnicodeString (&win32, &upath);
}
- /* Make sure it's NUL-termniated. */
+ /* Make sure it's NUL-terminated. */
win32.Buffer[win32.Length / sizeof (WCHAR)] = L'\0';
if (!doit) /* Virtual path */
drive_length = 0;