diff --git a/bash-5.1/r_execute_cmd/src/lib.rs b/bash-5.1/r_execute_cmd/src/lib.rs index fe0106882d8b9d8bd2552a8c1d6a6b0cb77cc299..f0837893de9837515006e18ac220ed85911f76a1 100644 --- a/bash-5.1/r_execute_cmd/src/lib.rs +++ b/bash-5.1/r_execute_cmd/src/lib.rs @@ -1930,9 +1930,43 @@ pub unsafe extern "C" fn coproc_reap() { } } +#[no_mangle] +pub unsafe extern "C" fn coproc_rclose(mut cp: *mut coproc, mut fd: libc::c_int) { + if (*cp).c_rfd >= 0 && (*cp).c_rfd == fd { + close((*cp).c_rfd); + (*cp).c_rfd = -1; + } +} +#[no_mangle] +pub unsafe extern "C" fn coproc_wclose(mut cp: *mut coproc, mut fd: libc::c_int) { + if (*cp).c_wfd >= 0 && (*cp).c_wfd == fd { + close((*cp).c_wfd); + (*cp).c_wfd = -1; + } +} +#[no_mangle] +pub unsafe extern "C" fn coproc_checkfd(mut cp: *mut coproc, mut fd: libc::c_int) { + let mut update: libc::c_int = 0; + + update = 0 ; + if (*cp).c_rfd >= 0 && (*cp).c_rfd == fd { + let ref mut fresh28 = (*cp).c_rfd; + (*cp).c_rfd = -1; + update = -1; + } + if (*cp).c_wfd >= 0 && (*cp).c_wfd == fd { + let ref mut fresh29 = (*cp).c_wfd; + (*cp).c_wfd = -1; + update = -1; + } + if update != 0 { + coproc_setvars(cp); + } +} +