summaryrefslogtreecommitdiff
path: root/repo/apps/chromium/scoped-file.patch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
commit739c65c54cb0e957df5e9b76f93fb02554e5cac3 (patch)
tree09ddfa0a342f3ea9de136cb50abdd79821bf1b53 /repo/apps/chromium/scoped-file.patch
parent4c585ad54388285500fd18a6aaa516894e0f2c16 (diff)
moved everything to new file formatting
Diffstat (limited to 'repo/apps/chromium/scoped-file.patch')
-rw-r--r--repo/apps/chromium/scoped-file.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/repo/apps/chromium/scoped-file.patch b/repo/apps/chromium/scoped-file.patch
new file mode 100644
index 0000000..34bf6eb
--- /dev/null
+++ b/repo/apps/chromium/scoped-file.patch
@@ -0,0 +1,31 @@
+--- ./base/files/scoped_file_linux.cc.orig
++++ ./base/files/scoped_file_linux.cc
+@@ -7,6 +7,7 @@
+ #include <algorithm>
+ #include <array>
+ #include <atomic>
++#include <dlfcn.h>
+
+ #include "base/compiler_specific.h"
+ #include "base/debug/stack_trace.h"
+@@ -80,9 +81,18 @@
+
+ extern "C" {
+
+-int __close(int);
+-
+ __attribute__((visibility("default"), noinline)) int close(int fd) {
++ static int (*__close)(int) = nullptr;
++
++ if (__close == nullptr) {
++ __close = (int (*)(int))dlsym(RTLD_NEXT, "close");
++
++ if (__close == nullptr) {
++ RAW_LOG(ERROR, "musl close not found\n");
++ IMMEDIATE_CRASH();
++ }
++ }
++
+ if (base::IsFDOwned(fd) && g_is_ownership_enforced)
+ CrashOnFdOwnershipViolation();
+ return __close(fd);