delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/08/10:53:14

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
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" <jw2357 AT hotmail DOT com>, cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: 1.3.2 rmdir fails if CWD is in the directory to be deleted?
In-Reply-To: <F109GktCVnHziBXB5ia0000b7b6@hotmail.com>
Mime-Version: 1.0

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019