{
slipif *sl = 0;
int pin[2] = { -1, -1 }, pout[2] = { -1, -1 };
+ mdup_fd md[2];
pid_t kid = -1;
dstr d = DSTR_INIT;
unsigned char ch;
goto fail;
}
if (!kid) {
- close(pin[1]);
- close(pout[0]);
- dup2(pin[0], STDIN_FILENO);
- dup2(pout[1], STDOUT_FILENO);
+ close(pin[1]); close(pout[0]);
+ md[0].cur = pin[0]; md[0].want = STDIN_FILENO;
+ md[1].cur = pout[1]; md[1].want = STDOUT_FILENO;
+ mdup(md, 2);
execlp(slipcmd, slipcmd, p_name(p), (char *)0);
_exit(127);
}
const tunnel_ops tun_slip = {
"slip",
- t_init,
0,
+ t_init,
t_create,
t_setifname,
t_inject,