[zeroize] Support musl-libc by compiling a backport for explicit_bzero
@@ -43,9 +43,19 @@ mod linux {
.unwrap();
if !output.status.success() {
+ let stderr = String::from_utf8(output.stderr).unwrap();
+ let libc_info = stderr.split('\n').collect::<Vec<&str>>()[0];
+ let libc_name = libc_info.split(' ').collect::<Vec<&str>>()[0];
+
+ if libc_name != "musl" {
panic!("/usr/bin/ldd --version exited with error: {:?}", output);
}
+ // Return a version less than the least glibc version to support explicit_bzero
+ // to force compilation of our backport.
+ return "2.24".to_owned();
+ }
+
let stdout = String::from_utf8(output.stdout).unwrap();
let info = stdout.split('\n').next().unwrap();
info.split(' ').last().unwrap().to_owned()
