From 327d5da8f0740293ea347dde57f4d4985b5d59c4 Mon Sep 17 00:00:00 2001 From: Mark Tucker Date: Sat, 12 Mar 2022 11:25:16 -0500 Subject: [PATCH] Reapply fix from #1465 that was reverted by #1580 (presumably by accident). Add a FILE_SHARE_READ flag to the CreateFile call that is used to open a symlink location on Windows. This failure was manifesting as a rare intermittent failure to properly resolve a file path inside a symlinked directory on Windows when running many simultaneous processes reading and writing USD files inside this symlinked directory. --- pxr/base/arch/fileSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/base/arch/fileSystem.cpp b/pxr/base/arch/fileSystem.cpp index f236bcbea6..6106854460 100644 --- a/pxr/base/arch/fileSystem.cpp +++ b/pxr/base/arch/fileSystem.cpp @@ -1155,7 +1155,7 @@ typedef struct _REPARSE_DATA_BUFFER { std::string ArchReadLink(const char* path) { HANDLE handle = ::CreateFileW( - ArchWindowsUtf8ToUtf16(path).c_str(), GENERIC_READ, 0, + ArchWindowsUtf8ToUtf16(path).c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL);