Skip to content

Commit 3136919

Browse files
committed
Improve musl detection (#280)
1 parent 8eb95d0 commit 3136919

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/lmdbjava/TargetName.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.IOException;
2222
import java.nio.file.Files;
2323
import java.nio.file.Paths;
24+
import java.util.stream.Stream;
2425

2526
/**
2627
* Determines the name of the target LMDB native library.
@@ -171,10 +172,8 @@ private static String resolveToolchain(final String os) {
171172
}
172173

173174
private static boolean isMuslLibc() {
174-
try {
175-
return Files.lines(Paths.get("/proc/self/maps"))
176-
.filter(line -> line.contains("libc"))
177-
.anyMatch(line -> line.contains("musl"));
175+
try (Stream<String> lines = Files.lines(Paths.get("/proc/self/maps"))) {
176+
return lines.anyMatch(line -> line.contains("/ld-musl"));
178177
} catch (final IOException e) {
179178
return false;
180179
}

0 commit comments

Comments
 (0)