* syscalls.cc (rename): Handle a special case of trying to rename a
mount point.
This commit is contained in:
parent
a66789a0c0
commit
48726c8a06
|
@ -1,3 +1,8 @@
|
||||||
|
2008-03-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* syscalls.cc (rename): Handle a special case of trying to rename a
|
||||||
|
mount point.
|
||||||
|
|
||||||
2008-03-12 Corinna Vinschen <corinna@vinschen.de>
|
2008-03-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* environ.h: Fix comment.
|
* environ.h: Fix comment.
|
||||||
|
|
|
@ -1573,13 +1573,21 @@ rename (const char *oldpath, const char *newpath)
|
||||||
/* First check if oldpath and newpath only differ by case. If so, it's
|
/* First check if oldpath and newpath only differ by case. If so, it's
|
||||||
just a request to change the case of the filename. By simply setting
|
just a request to change the case of the filename. By simply setting
|
||||||
the file attributes to INVALID_FILE_ATTRIBUTES (which translates to
|
the file attributes to INVALID_FILE_ATTRIBUTES (which translates to
|
||||||
"file doesn't exist"), all later tests are skipped. */
|
"file doesn't exist"), all later tests are skipped.
|
||||||
if (newpc.exists ()
|
If not, it's a request to change the case of the name of a mount
|
||||||
&& equal_path
|
point. If we don't catch this here, the underlying directory would
|
||||||
&& !RtlEqualUnicodeString (oldpc.get_nt_native_path (),
|
be deleted, if it happens to be empty. */
|
||||||
|
if (newpc.exists () && equal_path)
|
||||||
|
{
|
||||||
|
if (RtlEqualUnicodeString (oldpc.get_nt_native_path (),
|
||||||
newpc.get_nt_native_path (),
|
newpc.get_nt_native_path (),
|
||||||
FALSE))
|
FALSE))
|
||||||
|
{
|
||||||
|
set_errno (EACCES);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
newpc.file_attributes (INVALID_FILE_ATTRIBUTES);
|
newpc.file_attributes (INVALID_FILE_ATTRIBUTES);
|
||||||
|
}
|
||||||
else if (oldpc.isdir ())
|
else if (oldpc.isdir ())
|
||||||
{
|
{
|
||||||
if (newpc.exists () && !newpc.isdir ())
|
if (newpc.exists () && !newpc.isdir ())
|
||||||
|
|
Loading…
Reference in New Issue