From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) Message-Id: <10109240611.AA16676@clio.rice.edu> Subject: Deep dir problems To: djgpp-workers AT delorie DOT com (DJGPP developers) Date: Mon, 24 Sep 2001 01:11:55 -0500 (CDT) 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 At this point I don't see any way to make deep directory chdir()s work on NT+LFN, Win 2000 (normal or LFN). This means no sophisticated builds which insist on chdir()ing deep. Better would be to fix apps to avoid chdir()ing. The only thing I can suggest is the following: 1) Change chdir() to check for bad directories. Prevent setting directory if not OK (just in case failure ignored), return error code. 2) chdir() currently calls fixpath. If the return from fixpath is not the root directory then getcwd() shouldn't be either. 3) call getcwd before starting, save it. do chdir. call getcwd again. if getcwd is root directory and fixpath result wasn't, chdir to original, set error flag, return. This would be two extra system calls. Given the observation this can fail with lfn=n on other Win systems I think all systems should have it. If we trust everyone to check return codes, we could avoid the first getcwd and only set the failure code if getcwd is root and shouldn't be. Given that rm -rf / is about the worse thing you can do to a system, I don't think we should fool around on this one. Let's do it for all platforms.