From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10110020315.AA17585@clio.rice.edu> Subject: Maybe fix deep path bug To: wojciech DOT galazka AT polkomtel DOT com DOT pl (Wojciech Galazka) Date: Mon, 1 Oct 2001 22:15:06 -0500 (CDT) Cc: djgpp-workers AT delorie DOT com In-Reply-To: <250B3114DA16D511B82C00E0094005F8023FC1C3@MSGWAW11> from "Wojciech Galazka" at Oct 01, 2001 11:31:29 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk A simple change of order of operations to set the drive letter before setting the directory seems to make the problem go away. Not fully tested on other platforms. Seems to work just fine if I set a bogus letter since the change directory catches it. Comments? *** chdir.c_ Tue Aug 22 12:41:16 2000 --- chdir.c Mon Oct 1 22:11:30 2001 *************** __chdir (const char *mydirname) *** 48,51 **** --- 48,59 ---- drv_no = (_farpeekb(_dos_ds, __tb) & 0x1f) - 1; + if (drv_no != -1) /* Must do this first on Win 2K with long paths. */ + { + /* Change current drive. The directory change below checks it. */ + r.h.ah = 0x0e; + r.h.dl = drv_no; + __dpmi_int(0x21, &r); + } + if (drv_no == -1 || _farpeekb(_dos_ds, __tb + 2) != 0) { *************** __chdir (const char *mydirname) *** 64,76 **** } - if (drv_no != -1) - { - /* Change current drive also. This *will* work if - the directory change above worked. */ - r.h.ah = 0x0e; - r.h.dl = drv_no; - __dpmi_int(0x21, &r); - } - return 0; } --- 72,75 ----