[llvm] r234611 - [FS] Report errors from llvm::sys::fs::rename on Windows

Reid Kleckner reid at kleckner.net
Fri Apr 10 10:20:45 PDT 2015


Author: rnk
Date: Fri Apr 10 12:20:45 2015
New Revision: 234611

URL: http://llvm.org/viewvc/llvm-project?rev=234611&view=rev
Log:
[FS] Report errors from llvm::sys::fs::rename on Windows

Previously we would always report success, which is pretty bogus.

I'm too lazy to write a test where rename will portably fail on all
platforms. I'm just trying to fix breakage introduced by r234597, which
happened to tickle this.

Modified:
    llvm/trunk/lib/Support/Windows/Path.inc

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=234611&r1=234610&r2=234611&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Fri Apr 10 12:20:45 2015
@@ -261,6 +261,7 @@ std::error_code rename(const Twine &from
                       MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))
       return std::error_code();
     DWORD LastError = ::GetLastError();
+    ec = windows_error(LastError);
     if (LastError != ERROR_ACCESS_DENIED)
       break;
     // Retry MoveFile() at ACCESS_DENIED.





More information about the llvm-commits mailing list