Skip to content

Commit 6941c71

Browse files
committed
Fix broken overloading of libc close in static OpenWrt build
1 parent 984c27b commit 6941c71

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/base/files/scoped_file_linux.cc

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ bool IsFDOwned(int fd) {
8181

8282
} // namespace base
8383

84+
#ifndef OPENWRT_BUILD_STATIC
85+
8486
using LibcCloseFuncPtr = int (*)(int);
8587

8688
// Load the libc close symbol to forward to from the close wrapper.
@@ -110,3 +112,5 @@ __attribute__((visibility("default"), noinline)) int close(int fd) {
110112
}
111113

112114
} // extern "C"
115+
116+
#endif // OPENWRT_BUILD_STATIC

src/build/config/openwrt/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config("compiler") {
3232
if (build_static) {
3333
# Musl static objects are not built with -fPIC, cannot use -static-pie.
3434
ldflags += [ "-static" ]
35+
defines += [ "OPENWRT_BUILD_STATIC" ]
3536
} else if (current_cpu == "x86") {
3637
ldflags += [ "-Wl,--dynamic-linker=/lib/ld-musl-i386.so.1" ]
3738
} else if (current_cpu == "mipsel") {

0 commit comments

Comments
 (0)