Changeset 82552 in vbox for trunk/src/VBox/Main/src-helper-apps
- Timestamp:
- Dec 11, 2019 2:36:06 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135422
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
r80569 r82552 37 37 #include <iprt/string.h> 38 38 #include <iprt/stream.h> 39 #include <iprt/thread.h> 39 40 #include <iprt/utf16.h> 40 41 #include <iprt/vfs.h> … … 221 222 222 223 /** 224 * Wrapper around RTDirRename that may retry the operation for up to 15 seconds 225 * on windows to deal with AV software. 226 */ 227 static int CommonDirRenameWrapper(const char *pszSrc, const char *pszDst, uint32_t fFlags) 228 { 229 #ifdef RT_OS_WINDOWS 230 uint64_t nsNow = RTTimeNanoTS(); 231 for (;;) 232 { 233 int rc = RTDirRename(pszSrc, pszDst, fFlags); 234 if ( ( rc == VERR_ACCESS_DENIED 235 || rc == VERR_SHARING_VIOLATION) 236 && RTTimeNanoTS() - nsNow < RT_NS_15SEC) 237 return rc; 238 RTThreadSleep(128); 239 } 240 #else 241 return RTDirRename(pszSrc, pszDst, fFlags); 242 #endif 243 } 244 245 /** 223 246 * Common uninstall worker used by both uninstall and install --replace. 224 247 * … … 237 260 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to construct temporary extension pack path: %Rrc", rc); 238 261 239 rc = RTDirRename(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);262 rc = CommonDirRenameWrapper(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE); 240 263 if (rc == VERR_ALREADY_EXISTS) 241 264 { … … 245 268 installation directory.) */ 246 269 RemoveExtPackDir(szExtPackUnInstDir, false /*fTemporary*/); 247 rc = RTDirRename(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);270 rc = CommonDirRenameWrapper(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE); 248 271 } 249 272 if (RT_FAILURE(rc)) … … 752 775 if (rcExit == RTEXITCODE_SUCCESS) 753 776 { 754 rc = RTDirRename(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);777 rc = CommonDirRenameWrapper(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE); 755 778 if ( RT_FAILURE(rc) 756 779 && fReplace … … 760 783 rcExit = CommonUninstallWorker(szFinalPath); 761 784 if (rcExit == RTEXITCODE_SUCCESS) 762 rc = RTDirRename(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);785 rc = CommonDirRenameWrapper(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE); 763 786 } 764 787 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.