X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1/iu/tXKvvij3q8uplCVBkUfsK2u+J33KFhNQqLii ElhWxXAkxiqyWQ From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Fixing root path treatment in __get_current_directory Date: Thu, 29 Nov 2007 12:16:09 +0100 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711291216.09992.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com 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