Skip to content

Commit e6fca32

Browse files
committed
Don't set errno in reentrant function
1 parent c86572d commit e6fca32

2 files changed

Lines changed: 0 additions & 4 deletions

File tree

‎rules/pwd/tgt_refcount.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn f2(a0: u32, a1: Ptr<Passwd>, a2: Ptr<u8>, a3: usize, a4: Ptr<Ptr<Passwd>>) ->
2424
let __needed: usize = __strs.iter().map(|__s| __s.len() + 1).sum();
2525
if __needed > __buflen {
2626
__out.write(Ptr::null());
27-
libcc2rs::cpp2rust_errno().write(::libc::ERANGE);
2827
::libc::ERANGE
2928
} else {
3029
let mut __ptrs: Vec<Ptr<u8>> = Vec::new();
@@ -49,7 +48,6 @@ fn f2(a0: u32, a1: Ptr<Passwd>, a2: Ptr<u8>, a3: usize, a4: Ptr<Ptr<Passwd>>) ->
4948
}
5049
Err(__e) => {
5150
__out.write(Ptr::null());
52-
libcc2rs::cpp2rust_errno().write(__e as i32);
5351
__e as i32
5452
}
5553
}

‎tests/unit/pwd.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ static void test_getpwuid_r_erange(void) {
4040
struct passwd pw;
4141
char tiny[1];
4242
struct passwd *result = NULL;
43-
errno = 0;
4443
assert(getpwuid_r(geteuid(), &pw, tiny, sizeof(tiny), &result) == ERANGE);
4544
assert(result == NULL);
46-
assert(errno == ERANGE);
4745
}
4846

4947
int main(void) {

0 commit comments

Comments
 (0)