Mail Archives: djgpp-workers/2007/12/03/13:52:34
I have used realpath to canonicalize the following path:
c:foo\bar
The working dir on drive c: is the root dir. realpath
returns:
c:\/foo/bar
The leading slash will always be added by the calling __canonicalize_path()
function and the backslash that is returned by int 0x21 function 0x7160
is superlfluos.
The patch below will fix this.
Regards,
Juan M. Guerrero
Index: src/libc/posix/sys/stat/fixpath.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/fixpath.c,v
retrieving revision 1.8
diff -u -r1.8 fixpath.c
--- src/libc/posix/sys/stat/fixpath.c 25 Sep 2002 21:45:20 -0000 1.8
+++ src/libc/posix/sys/stat/fixpath.c 3 Dec 2007 18:44:38 -0000
@@ -87,11 +87,9 @@
dosmemget(__tb + FILENAME_MAX, sizeof(tmpbuf), tmpbuf);
/* Validate return form and drive matches what _fixpath expects. */
- if (tmpbuf[0] == (drive_number + 'A') && tmpbuf[1] == ':')
- {
- strcpy(out, tmpbuf+2); /* Trim drive, just directory */
- return out + strlen(out);
- }
+ if (tmpbuf[0] == (drive_number + 'A') && tmpbuf[1] == ':' && tmpbuf[2] == '\\')
+ /* Root path, don't insert "/", it'll be added later */
+ return out;
}
#ifdef TEST
else
- Raw text -