This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 1.3.2 rmdir fails if CWD is in the directory to be deleted?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]