Skip to main content

closemnodes

Function closemnodes 

Source
pub fn closemnodes(mfds: &mut [Option<Box<multio>>; 10])
Expand description

Port of static void closemnodes(struct multio **mfds) from Src/exec.c:2344.

C body:

int i, j;
for (i = 0; i < 10; i++)
    if (mfds[i]) {
        for (j = 0; j < mfds[i]->ct; j++)
            zclose(mfds[i]->fds[j]);
        mfds[i] = NULL;
    }

Failure-path cleanup: close every fd stashed in any of the 10 multio slots and null the slot. Called from execcmd_exec when a redirect setup fails partway through and we need to roll back.