char **errbuf;
int infd;
- int inpipe;
int outfd;
int errfd;
int *outfdptr;
cmd->handshakeNotify[1] = -1;
cmd->infd = cmd->outfd = cmd->errfd = -1;
- cmd->inpipe = -1;
cmd->pid = -1;
virCommandAddArgSet(cmd, args);
* Manage input and output to the child process.
*/
static int
-virCommandProcessIO(virCommandPtr cmd)
+virCommandProcessIO(virCommandPtr cmd, int *inpipe)
{
int infd = -1, outfd = -1, errfd = -1;
size_t inlen = 0, outlen = 0, errlen = 0;
* via pipe */
if (cmd->inbuf) {
inlen = strlen(cmd->inbuf);
- infd = cmd->inpipe;
+ infd = *inpipe;
}
/* With out/err buffer, the outfd/errfd have been filled with an
} else {
inoff += done;
if (inoff == inlen) {
- int tmpfd ATTRIBUTE_UNUSED;
- tmpfd = infd;
- if (VIR_CLOSE(infd) < 0)
- VIR_DEBUG("ignoring failed close on fd %d", tmpfd);
+ if (VIR_CLOSE(*inpipe) < 0)
+ VIR_DEBUG("ignoring failed close on fd %d", infd);
+ infd = -1;
}
}
}
return -1;
}
cmd->infd = infd[0];
- cmd->inpipe = infd[1];
}
/* If caller requested the same string for stdout and stderr, then
}
if (string_io)
- ret = virCommandProcessIO(cmd);
+ ret = virCommandProcessIO(cmd, &infd[1]);
if (virCommandWait(cmd, exitstatus) < 0)
ret = -1;