Skip to content

Commit 61d74fb

Browse files
committed
Set errno
1 parent 23abd4d commit 61d74fb

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

‎rules/arpa_inet/tgt_refcount.rs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn f5(a0: i32, a1: Ptr<u8>, a2: AnyPtr) -> i32 {
2727
Err(_) => 0,
2828
}
2929
} else {
30+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
3031
-1
3132
}
3233
}
@@ -55,6 +56,13 @@ fn f6(a0: i32, a1: AnyPtr, a2: Ptr<u8>, a3: u32) -> Ptr<u8> {
5556
a2.offset(__s.len()).write(0);
5657
a2.clone()
5758
}
58-
_ => Ptr::null(),
59+
Some(_) => {
60+
libcc2rs::cpp2rust_errno().write(::libc::ENOSPC);
61+
Ptr::null()
62+
}
63+
None => {
64+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
65+
Ptr::null()
66+
}
5967
}
6068
}

‎tests/unit/out/refcount/inet_pton_ntop.rs‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ fn main_0() -> i32 {
5151
Err(_) => 0,
5252
}
5353
} else {
54+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
5455
-1
5556
} == 1) as i32)
5657
!= 0)
@@ -103,6 +104,7 @@ fn main_0() -> i32 {
103104
Err(_) => 0,
104105
}
105106
} else {
107+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
106108
-1
107109
} == 0) as i32)
108110
!= 0)
@@ -145,6 +147,7 @@ fn main_0() -> i32 {
145147
Err(_) => 0,
146148
}
147149
} else {
150+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
148151
-1
149152
} == 0) as i32)
150153
!= 0)
@@ -187,6 +190,7 @@ fn main_0() -> i32 {
187190
Err(_) => 0,
188191
}
189192
} else {
193+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
190194
-1
191195
} == 1) as i32)
192196
!= 0)
@@ -234,6 +238,7 @@ fn main_0() -> i32 {
234238
Err(_) => 0,
235239
}
236240
} else {
241+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
237242
-1
238243
} == 1) as i32)
239244
!= 0)
@@ -287,7 +292,14 @@ fn main_0() -> i32 {
287292
(text.as_pointer() as Ptr<u8>).offset(__s.len()).write(0);
288293
(text.as_pointer() as Ptr<u8>).clone()
289294
}
290-
_ => Ptr::null(),
295+
Some(_) => {
296+
libcc2rs::cpp2rust_errno().write(::libc::ENOSPC);
297+
Ptr::null()
298+
}
299+
None => {
300+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
301+
Ptr::null()
302+
}
291303
}
292304
}
293305
.to_c_string_iterator();
@@ -362,7 +374,14 @@ fn main_0() -> i32 {
362374
(text.as_pointer() as Ptr<u8>).offset(__s.len()).write(0);
363375
(text.as_pointer() as Ptr<u8>).clone()
364376
}
365-
_ => Ptr::null(),
377+
Some(_) => {
378+
libcc2rs::cpp2rust_errno().write(::libc::ENOSPC);
379+
Ptr::null()
380+
}
381+
None => {
382+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
383+
Ptr::null()
384+
}
366385
}
367386
}
368387
.to_c_string_iterator();
@@ -415,7 +434,14 @@ fn main_0() -> i32 {
415434
(text.as_pointer() as Ptr<u8>).offset(__s.len()).write(0);
416435
(text.as_pointer() as Ptr<u8>).clone()
417436
}
418-
_ => Ptr::null(),
437+
Some(_) => {
438+
libcc2rs::cpp2rust_errno().write(::libc::ENOSPC);
439+
Ptr::null()
440+
}
441+
None => {
442+
libcc2rs::cpp2rust_errno().write(::libc::EAFNOSUPPORT);
443+
Ptr::null()
444+
}
419445
}
420446
})
421447
.is_null()) as i32)

0 commit comments

Comments
 (0)