The parent path computation was leaving trailing slashes on the
path names which prevented the creation of mount points and symlinks
when UNC paths were used that contained mount points.
LICENSE MIT
Change-Id: I50cba9cb8a2b0ad45f84995d05f368052be683cc
Reviewed-on: http://gerrit.openafs.org/2886
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
}
tp = strrchr(tspace, '\\');
if (tp) {
- *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
+ if (tp - tspace > 2 &&
+ tspace[1] == ':' &&
+ &tspace[2] == tp)
+ *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
+ else
+ *tp = 0;
}
else {
fs_ExtractDriveLetter(apath, tspace);
}
/* return a static pointer to a buffer */
-static char *Parent(apath)
-char *apath; {
+static char *Parent(char *apath)
+{
char *tp;
strcpy(tspace, apath);
tp = strrchr(tspace, '\\');
if (tp) {
- *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
+ if (tp - tspace > 2 &&
+ tspace[1] == ':' &&
+ &tspace[2] == tp)
+ *(tp+1) = 0; /* lv trailing slash so Parent("k:\foo") is "k:\" not "k:" */
+ else
+ *tp = 0;
}
else {
fs_ExtractDriveLetter(apath, tspace);