2004-03-14 Pierre Humblet <pierre.humblet@ieee.org>
* dir.cc (rmdir): Construct real_dir with flag PC_FULL. Use a loop instead of recursion to handle the current directory.
This commit is contained in:
parent
f8a8e7a1f6
commit
83a74ea24a
|
@ -1,3 +1,8 @@
|
||||||
|
2004-03-14 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
|
* dir.cc (rmdir): Construct real_dir with flag PC_FULL.
|
||||||
|
Use a loop instead of recursion to handle the current directory.
|
||||||
|
|
||||||
2004-03-14 Christopher Faylor <cgf@redhat.com>
|
2004-03-14 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* cygtls.cc (_cygtls::remove): Call remove_wq to ensure that wait stuff
|
* cygtls.cc (_cygtls::remove): Call remove_wq to ensure that wait stuff
|
||||||
|
@ -94,7 +99,7 @@
|
||||||
* sigproc.h (waitq): Delete declaration.
|
* sigproc.h (waitq): Delete declaration.
|
||||||
* wait.cc (wait4): Use _my_tls waitq structure rather than per_thread.
|
* wait.cc (wait4): Use _my_tls waitq structure rather than per_thread.
|
||||||
|
|
||||||
2004-02-11 Pierre Humblet <pierre.humblet@ieee.org>
|
2004-03-11 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* cygtls.h (_cygtls::newmask): Delete member.
|
* cygtls.h (_cygtls::newmask): Delete member.
|
||||||
(_cygtls::deltamask): New member.
|
(_cygtls::deltamask): New member.
|
||||||
|
|
|
@ -308,7 +308,7 @@ rmdir (const char *dir)
|
||||||
int res = -1;
|
int res = -1;
|
||||||
DWORD devn;
|
DWORD devn;
|
||||||
|
|
||||||
path_conv real_dir (dir, PC_SYM_NOFOLLOW);
|
path_conv real_dir (dir, PC_SYM_NOFOLLOW | PC_FULL);
|
||||||
|
|
||||||
if (real_dir.error)
|
if (real_dir.error)
|
||||||
set_errno (real_dir.error);
|
set_errno (real_dir.error);
|
||||||
|
@ -326,6 +326,8 @@ rmdir (const char *dir)
|
||||||
SetFileAttributes (real_dir,
|
SetFileAttributes (real_dir,
|
||||||
(DWORD) real_dir & ~FILE_ATTRIBUTE_READONLY);
|
(DWORD) real_dir & ~FILE_ATTRIBUTE_READONLY);
|
||||||
|
|
||||||
|
for (bool is_cwd = false; ; is_cwd = true)
|
||||||
|
{
|
||||||
int rc = RemoveDirectory (real_dir);
|
int rc = RemoveDirectory (real_dir);
|
||||||
DWORD att = GetFileAttributes (real_dir);
|
DWORD att = GetFileAttributes (real_dir);
|
||||||
|
|
||||||
|
@ -347,21 +349,16 @@ rmdir (const char *dir)
|
||||||
directory. If so, we will move elsewhere to potentially allow the
|
directory. If so, we will move elsewhere to potentially allow the
|
||||||
rmdir to succeed. This means that cygwin's concept of the current working
|
rmdir to succeed. This means that cygwin's concept of the current working
|
||||||
directory != Windows concept but, hey, whaddaregonnado?
|
directory != Windows concept but, hey, whaddaregonnado?
|
||||||
Note that this will not cause something like the following to work:
|
|
||||||
$ cd foo
|
|
||||||
$ rmdir .
|
|
||||||
since the shell will have foo "open" in the above case and so Windows will
|
|
||||||
not allow the deletion.
|
|
||||||
FIXME: A potential workaround for this is for cygwin apps to *never* call
|
FIXME: A potential workaround for this is for cygwin apps to *never* call
|
||||||
SetCurrentDirectory. */
|
SetCurrentDirectory. */
|
||||||
if (strcasematch (real_dir, cygheap->cwd.win32)
|
if (strcasematch (real_dir, cygheap->cwd.win32)
|
||||||
&& !strcasematch ("c:\\", cygheap->cwd.win32))
|
&& !strcasematch ("c:\\", cygheap->cwd.win32) && !is_cwd)
|
||||||
{
|
{
|
||||||
DWORD err = GetLastError ();
|
DWORD err = GetLastError ();
|
||||||
if (!SetCurrentDirectory ("c:\\"))
|
if (!SetCurrentDirectory ("c:\\"))
|
||||||
SetLastError (err);
|
SetLastError (err);
|
||||||
else if ((res = rmdir (dir)))
|
else
|
||||||
SetCurrentDirectory (cygheap->cwd.win32);
|
continue;
|
||||||
}
|
}
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
|
@ -376,10 +373,13 @@ rmdir (const char *dir)
|
||||||
/* If directory still exists, restore R/O attribute. */
|
/* If directory still exists, restore R/O attribute. */
|
||||||
if (real_dir.has_attribute (FILE_ATTRIBUTE_READONLY))
|
if (real_dir.has_attribute (FILE_ATTRIBUTE_READONLY))
|
||||||
SetFileAttributes (real_dir, real_dir);
|
SetFileAttributes (real_dir, real_dir);
|
||||||
|
if (is_cwd)
|
||||||
|
SetCurrentDirectory (cygheap->cwd.win32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
syscall_printf ("%d = rmdir (%s)", res, dir);
|
syscall_printf ("%d = rmdir (%s)", res, dir);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue