Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <5.1.0.14.2.20010908074433.00b01548@pop3.cris.com> X-Sender: rrschulz AT pop3 DOT cris DOT com X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sat, 08 Sep 2001 07:51:20 -0700 To: "John William" , cygwin AT cygwin DOT com From: Randall R Schulz Subject: Re: 1.3.2 rmdir fails if CWD is in the directory to be deleted? In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed John, Surely you're not suggesting that the side-effect of changing directory to the root be an inevitable consequence of removing a directory. Clearly, if this work-around works for you, then you should wrap the rmdir call in one of your own that applies this "fix." As Chris pointed out, there are Unixes out there where your code will not work, so it would seem you're relying on undocumented details. As far as I can recall, I've never seen the details I outlined of how removing things work mentioned as part of a Unix system call description. This is a classic reliance on undocumented details and it has bitten you. Nothing new about that, either. Randy At 22:48 2001-09-07, John William wrote: >Ok, if this is a fundamental limitation of Windows, I can accept that. But >there must be a workaround -- after all, DJGPP works. I tried modifying my >code such that: > >rmdir_workaround(dir) > char *dir; >{ > chdir("/"); > return(rmdir(dir)); >} > >...and that seems to work just fine. > >Yes, it's a cheap hack, but maybe DJGPP does something similar. This code >will, of course, fail if the program relies on chdir("..") always working, >so this isn't a complete fix, but it's better than not having the program >work at all. The "real" fix would probably be to have an internal path, >separate from the Windows path, so chdir("..") would work and Windows >wouldn't have to know that the CWD was invalid before the chdir(".."). >Just a thought. > >Anyhow, thanks for the help and info! > >- John -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/