* syscalls.cc (rename): Fix renaming file-based devices.

This commit is contained in:
Corinna Vinschen 2010-08-18 15:21:35 +00:00
parent 75a3b85877
commit ce9898da68
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2010-08-18 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (rename): Fix renaming file-based devices.
2010-08-18 Corinna Vinschen <corinna@vinschen.de> 2010-08-18 Corinna Vinschen <corinna@vinschen.de>
* exceptions.cc (open_stackdumpfile): Don't try to open file if we * exceptions.cc (open_stackdumpfile): Don't try to open file if we

View File

@ -1804,8 +1804,9 @@ rename (const char *oldpath, const char *newpath)
set_errno (ENOENT); set_errno (ENOENT);
goto out; goto out;
} }
if (oldpc.isspecial () && !oldpc.issocket ()) /* No renames from virtual FS */ if (oldpc.isspecial () && !oldpc.issocket () && !oldpc.is_fs_special ())
{ {
/* No renames from virtual FS */
set_errno (EROFS); set_errno (EROFS);
goto out; goto out;
} }
@ -1930,7 +1931,7 @@ rename (const char *oldpath, const char *newpath)
goto out; goto out;
} }
} }
else if (oldpc.is_lnk_symlink () else if (oldpc.is_lnk_special ()
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
&ro_u_lnk, TRUE)) &ro_u_lnk, TRUE))
rename_append_suffix (newpc, newpath, nlen, ".lnk"); rename_append_suffix (newpc, newpath, nlen, ".lnk");
@ -1958,9 +1959,9 @@ rename (const char *oldpath, const char *newpath)
goto out; goto out;
} }
} }
else if (oldpc.is_lnk_symlink ()) else if (oldpc.is_lnk_special ())
{ {
if (!newpc.is_lnk_symlink () if (!newpc.is_lnk_special ()
&& !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (), && !RtlEqualUnicodePathSuffix (newpc.get_nt_native_path (),
&ro_u_lnk, TRUE)) &ro_u_lnk, TRUE))
{ {
@ -1992,7 +1993,7 @@ rename (const char *oldpath, const char *newpath)
{ {
new2pc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes); new2pc.check (newpath, PC_SYM_NOFOLLOW, stat_suffixes);
newpc.get_nt_native_path ()->Length -= 4 * sizeof (WCHAR); newpc.get_nt_native_path ()->Length -= 4 * sizeof (WCHAR);
if (new2pc.is_binary () || new2pc.is_lnk_symlink ()) if (new2pc.is_binary () || new2pc.is_lnk_special ())
removepc = &new2pc; removepc = &new2pc;
} }
} }