Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leafi/9404f79bcd3c64e4d828c0c5e06f056d to your computer and use it in GitHub Desktop.
Save leafi/9404f79bcd3c64e4d828c0c5e06f056d to your computer and use it in GitHub Desktop.
Truly terrible patches to fix CoreCLR & CoreFX build on Arch Linux
prepare() {
cd "${srcdir}/${_coreclr}"
patch -p1 < "${srcdir}/gcc6-github-pull-5304.patch"
patch -p1 < "${srcdir}/segv-github-pull-6027.patch"
patch -p1 < "/home/leaf/unused-attr-write-coreclr.patch"
cd "${srcdir}/${_corefx}"
patch -p1 < "/home/leaf/unused-attr-write-corefx.patch"
}
diff --git a/src/pal/src/exception/seh.cpp b/src/pal/src/exception/seh.cpp
index 01de6e8..f6a2739 100644
--- a/src/pal/src/exception/seh.cpp
+++ b/src/pal/src/exception/seh.cpp
@@ -233,8 +233,11 @@ SEHProcessException(PEXCEPTION_POINTERS pointers)
{
// The exception happened in the page right below the stack limit,
// so it is a stack overflow
- write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1);
- PROCAbort();
+ if (write(STDERR_FILENO, StackOverflowMessage, sizeof(StackOverflowMessage) - 1)) {
+ PROCAbort();
+ } else {
+ PROCAbort();
+ }
}
}
diff --git a/tests/src/Common/Platform/platformdefines.cpp b/tests/src/Common/Platform/platformdefines.cpp
index 4caead5..9ab6c68 100644
--- a/tests/src/Common/Platform/platformdefines.cpp
+++ b/tests/src/Common/Platform/platformdefines.cpp
@@ -277,7 +277,7 @@ DWORD TP_GetFullPathName(LPWSTR fileName, DWORD nBufferLength, LPWSTR lpBuffer)
return GetFullPathNameW(fileName, nBufferLength, lpBuffer, NULL);
#else
char nativeFullPath[MAX_PATH];
- realpath(HackyConvertToSTR(fileName), nativeFullPath);
+ if (realpath(HackyConvertToSTR(fileName), nativeFullPath)) { }
LPWSTR fullPathForCLR = HackyConvertToWSTR(nativeFullPath);
wcscpy_s(lpBuffer, MAX_PATH, fullPathForCLR);
return wcslen(lpBuffer);
diff --git a/src/Native/System.Native/pal_process.cpp b/src/Native/System.Native/pal_process.cpp
index da3bf2e..74c4335 100644
--- a/src/Native/System.Native/pal_process.cpp
+++ b/src/Native/System.Native/pal_process.cpp
@@ -142,7 +142,7 @@ extern "C" int32_t SystemNative_ForkAndExecProcess(const char* filename,
// where the parent process uses members of Process, like ProcessName, when the Process
// is still the clone of this one. This is a best-effort attempt, so ignore any errors.
#if HAVE_PIPE2
- pipe2(waitForChildToExecPipe, O_CLOEXEC);
+ if (pipe2(waitForChildToExecPipe, O_CLOEXEC)) { } else { }
#endif
// Fork the child process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment