diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-01-19 14:54:18 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-01-19 14:54:18 +0000 |
commit | a32a9a87a1a2160f1fb98e25b8ca63f25226b9e5 (patch) | |
tree | 5fa27c7dcc987b18e772e75f179146636e26abb3 | |
parent | d5c977948bb2c66852d7a79a04484aa5c0eecaa4 (diff) | |
download | newlib-a32a9a87a1a2160f1fb98e25b8ca63f25226b9e5.zip newlib-a32a9a87a1a2160f1fb98e25b8ca63f25226b9e5.tar.gz newlib-a32a9a87a1a2160f1fb98e25b8ca63f25226b9e5.tar.bz2 |
* syscalls.cc (rename): Remove ill-conceived NFS workaround from
2013-01-10 for self-inflicted NFS server problem.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 49 |
2 files changed, 8 insertions, 46 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cd2f45a..8691260 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2013-01-19 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (rename): Remove ill-conceived NFS workaround from + 2013-01-10 for self-inflicted NFS server problem. + 2013-01-19 Christopher Faylor <me.cygwin2013@cgf.cx> * exceptions.cc (ctrl_c_handler): Remove special-case handler for diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a23611e..a9b5fcd 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2450,52 +2450,9 @@ retry: pfri = (PFILE_RENAME_INFORMATION) tp.w_get (); pfri->ReplaceIfExists = TRUE; pfri->RootDirectory = NULL; - if (oldpc.fs_is_nfs ()) - { - /* Workaround depressing NFS bug. FILE_RENAME_INFORMATION.FileName - *must* be relative to the parent directory of the original file, - otherwise NtSetInformationFile returns with STATUS_NOT_SAME_DEVICE. - Neither absolute paths, nor directory handle relative paths work - as expected! */ - PWCHAR oldp, dstp; - - /* Skip equivalent path prefix. We already know that both paths are - on the same drive anyway. */ - for (oldp = oldpc.get_nt_native_path ()->Buffer, - dstp = dstpc->get_nt_native_path ()->Buffer; - *oldp == *dstp; ++oldp, ++dstp) - ; - while (oldp[-1] != L'\\') - --oldp, --dstp; - /* Now oldp points to the first path component in oldpc different from - dstpc, vice versa for dstp and oldpc. To create a dstpc path relative - to oldpc, we now have to prepend as many ".." components to dstp, as - are still available in oldp. Example: - - oldpc = \??\UNC\server\a\b\c\d\e - dstpc = \??\UNC\server\a\b\f\g - - prefix: \??\UNC\server\a\b\ - oldp: c\d\e - dstp: f\g - dstp expressed relative to e's parent dir: ..\..\f\g - - So what we do here is to count the number of backslashes in oldp and - prepend one "..\" to dstp for each of them. */ - PWCHAR newdst = tp.w_get (); - PWCHAR newp = newdst; - while ((oldp = wcschr (++oldp, L'\\')) != NULL) - newp = wcpcpy (newp, L"..\\"); - newp = wcpcpy (newp, dstp); - pfri->FileNameLength = (newp - newdst) * sizeof (WCHAR); - memcpy (&pfri->FileName, newdst, pfri->FileNameLength); - } - else - { - pfri->FileNameLength = dstpc->get_nt_native_path ()->Length; - memcpy (&pfri->FileName, dstpc->get_nt_native_path ()->Buffer, - pfri->FileNameLength); - } + pfri->FileNameLength = dstpc->get_nt_native_path ()->Length; + memcpy (&pfri->FileName, dstpc->get_nt_native_path ()->Buffer, + pfri->FileNameLength); status = NtSetInformationFile (fh, &io, pfri, sizeof *pfri + pfri->FileNameLength, FileRenameInformation); |