[nielm@bigfoot.com: cygwin 1.5.7: rmdir of cwd with open file crashes process]

Pierre A. Humblet Pierre.Humblet@ieee.org
Sat Mar 13 01:37:00 GMT 2004

At 02:41 PM 3/12/2004 -0500, Christopher Faylor wrote:
>Anyone have time to look into this?

Infinite recursion of rmdir.

After a failure the idea is to chdir to c:\ and to delete the directory
ONCE again by calling rmdir, but SetCurrentDirectory does not update 
cygheap->cwd.win32, so ...

An obvious fix is to replace of call to rmdir by a call to 
RemoveDirectory (real_dir), but that looks too simple.
I don't see much in the ChangeLog. Any other suggestion?


         if (strcasematch (real_dir, cygheap->cwd.win32)
	      && !strcasematch ("c:\\", cygheap->cwd.win32))
	      DWORD err = GetLastError ();
	      if (!SetCurrentDirectory ("c:\\"))
		SetLastError (err);
	      else if ((res = rmdir (dir)))
		SetCurrentDirectory (cygheap->cwd.win32);

More information about the Cygwin-developers mailing list