}
unsafe fn mdup2(oldfd: RawFd, newfd: RawFd, what: &str) {
- match dup2(oldfd, newfd) {
+ match Errno::result(libc::dup2(oldfd, newfd)) {
Ok(got) if got == newfd => { },
Ok(_) => crashm("dup2 gave wrong return value"),
Err(e) => crashv!("dup2 ", what, ": ", e.desc()),
unsafe fn parent(st_rfd: RawFd) -> ! {
let mut exitstatus = 0u8;
loop {
- match read(st_rfd, slice::from_mut(&mut exitstatus)) {
+ // TODO rationalise/revert this when MSRV >= 1.66 and/or nix >= 30
+ let es_sl = slice::from_mut(&mut exitstatus);
+ let es_sl_l = es_sl.len();
+ let es_sl_p = es_sl.as_mut_ptr() as _;
+ match Errno::result(libc::read(st_rfd, es_sl_p, es_sl_l)) {
Ok(0) => crashm("startup/daemonisation failed"),
Ok(1) => libc::_exit(exitstatus.into()),
Ok(_) => crashm("read startup: excess read!"),