From 0cc297cf2d5db83a8c18475b4d968cb1b411770b Mon Sep 17 00:00:00 2001 From: Eric Auer Date: Sat, 15 Sep 2007 22:01:03 +0000 Subject: [PATCH] The truename function must use the current working directory of the virtual / created-by-subst drive when it resolves relative paths, even though truename returns the "real" drive and dir of where your files actually are in the end. Using the current directory of the "real" drive made truename give wrong results. PS: If "subst e: d:\" says "physical path x:\ cannot be made", then it refers to "making" a root dir. "subst e: d:\foo" works. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1357 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/newstuff.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/newstuff.c b/kernel/newstuff.c index 620109d..96fe4ea 100644 --- a/kernel/newstuff.c +++ b/kernel/newstuff.c @@ -425,6 +425,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) rootPos = p = dest + 2; if (*p != '/') /* i.e., it's a backslash! */ { + COUNT prevresult = result; if (!(mode & CDS_MODE_SKIP_PHYSICAL)) { tn_printf(("SUBSTing from: %S\n", cdsEntry->cdsCurrentPath)); @@ -441,6 +442,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) { /* sanity check if this really is a local drive still */ unsigned i = drLetterToNr(dest[0]); + /* truename returns the "real", not the "virtual" drive letter! */ if (i < lastdrive) /* sanity check #2 */ result = (result & 0xffe0) | i; } @@ -449,7 +451,9 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) *p = '\\'; /* force backslash! */ } p++; - if (DosGetCuDir((UBYTE)((result & 0x1f) + 1), p) < 0) + /* truename must use the CuDir of the "virtual" drive letter! */ + /* tn_printf(("DosGetCuDir drive #%u\n", prevresult & 0x1f)); */ + if (DosGetCuDir((UBYTE)((prevresult & 0x1f) + 1), p) < 0) return DE_PATHNOTFND; if (*src != '\\' && *src != '/') p += strlen(p); @@ -591,7 +595,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode) { strcpy(dest + 2, dest + j); } - result = (result & 0xffe0) | i; + result = (result & 0xffe0) | i; /* tweak drive letter (JOIN) */ current_ldt = cdsp; result &= ~IS_NETWORK; if (cdsp->cdsFlags & CDSNETWDRV)