diff --git a/Public/Src/Sandbox/Linux/bxl_observer.cpp b/Public/Src/Sandbox/Linux/bxl_observer.cpp index f73eff7a3..b4a34f220 100644 --- a/Public/Src/Sandbox/Linux/bxl_observer.cpp +++ b/Public/Src/Sandbox/Linux/bxl_observer.cpp @@ -334,12 +334,8 @@ AccessCheckResult BxlObserver::report_access_at(const char *syscallName, es_even AccessCheckResult BxlObserver::report_firstAllowWriteCheck(const char *fullPath) { - - struct stat buffer; - DWORD error = errno; - // Check the path exists as file - bool fileExists = real___lxstat(1, fullPath, &buffer) == 0 && !S_ISDIR(buffer.st_mode); - errno = error; + mode_t mode = get_mode(fullPath); + bool fileExists = mode != 0 && !S_ISDIR(mode); AccessReport report = { diff --git a/Public/Src/Sandbox/Linux/bxl_observer.hpp b/Public/Src/Sandbox/Linux/bxl_observer.hpp index ddac32471..a67fe3e4e 100644 --- a/Public/Src/Sandbox/Linux/bxl_observer.hpp +++ b/Public/Src/Sandbox/Linux/bxl_observer.hpp @@ -334,10 +334,13 @@ public: mode_t get_mode(const char *path) { + int old = errno; struct stat buf; - return real___lxstat(1, path, &buf) == 0 + mode_t result = real___lxstat(1, path, &buf) == 0 ? buf.st_mode : 0; + errno = old; + return result; } std::string normalize_path(const char *pathname, int oflags = 0) diff --git a/cg/nuget/cgmanifest.json b/cg/nuget/cgmanifest.json index eecf8ba10..5a7275eb4 100644 --- a/cg/nuget/cgmanifest.json +++ b/cg/nuget/cgmanifest.json @@ -4605,7 +4605,7 @@ "Type": "NuGet", "NuGet": { "Name": "runtime.linux-x64.BuildXL", - "Version": "0.1.0-20220726.12" + "Version": "0.1.0-20220726.16" } } }, diff --git a/config.dsc b/config.dsc index 0bb2d4573..527da345f 100644 --- a/config.dsc +++ b/config.dsc @@ -413,7 +413,7 @@ config({ // Runtime dependencies for Linux { id: "runtime.linux-x64.BuildXL", - version: "0.1.0-20220726.12", + version: "0.1.0-20220726.16", osSkip: importFile(f`config.microsoftInternal.dsc`).isMicrosoftInternal ? [] : [ "win", "macOS", "unix" ]