Skip to content

Commit ce5a36a

Browse files
committed
Read getenv names and values as raw bytes in refcount
1 parent 6b23c59 commit ce5a36a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎rules/cstdlib/tgt_refcount.rs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ fn f5(a0: usize, a1: usize) -> AnyPtr {
2020
}
2121

2222
fn f6(a0: Ptr<i8>) -> Ptr<i8> {
23-
match ::std::env::var(a0.to_rust_string()) {
24-
Ok(__val) => Ptr::alloc_c_str(__val.as_bytes()),
25-
Err(_) => Ptr::null(),
23+
use ::std::os::unix::ffi::OsStrExt;
24+
match a0.with_c_bytes(|__name| ::std::env::var_os(::std::ffi::OsStr::from_bytes(__name))) {
25+
Some(__val) => Ptr::alloc_c_str(__val.as_bytes()),
26+
None => Ptr::null(),
2627
}
2728
}
2829

0 commit comments

Comments
 (0)