* path.cc (symlink_info::check_reparse_point): Always check

SubstituteName for volume string to recognize volume mount points.
	Reuse subst when calling sys_wcstombs.
	* syscalls.cc (rename): Set errno to EBUSY when trying to rename
	volume mount points.  Explain why.
This commit is contained in:
Corinna Vinschen
2009-11-09 19:46:36 +00:00
parent ed66791aba
commit 16a72f7e4b
3 changed files with 21 additions and 6 deletions

View File

@@ -1758,6 +1758,16 @@ rename (const char *oldpath, const char *newpath)
set_errno (EROFS);
goto out;
}
if (oldpc.has_attribute (FILE_ATTRIBUTE_REPARSE_POINT) && !oldpc.issymlink ())
{
/* Volume mount point. If we try to rename a volume mount point, NT
returns STATUS_NOT_SAME_DEVICE ==> Win32 ERROR_NOT_SAME_DEVICE ==>
errno EXDEV. That's bad since mv(1) will now perform a cross-device
move. So what we do here is to treat the volume mount point just
like Linux treats a mount point. */
set_errno (EBUSY);
goto out;
}
if (old_dir_requested && !oldpc.isdir ())
{
/* Reject rename("file/","x"). */