Fixed segfault in StartPiped when out of file descriptors
This commit is contained in:
parent
c02b9ef265
commit
5774ce3b9e
1 changed files with 3 additions and 3 deletions
|
@ -311,15 +311,15 @@ pid_t Util::Procs::StartPiped(const char *const *argv, int *fdin, int *fdout, in
|
||||||
devnull = open("/dev/null", O_RDWR);
|
devnull = open("/dev/null", O_RDWR);
|
||||||
if (devnull == -1){
|
if (devnull == -1){
|
||||||
ERROR_MSG("Could not open /dev/null for process %s, reason: %s", argv[0], strerror(errno));
|
ERROR_MSG("Could not open /dev/null for process %s, reason: %s", argv[0], strerror(errno));
|
||||||
if (*fdin == -1){
|
if (fdin && *fdin == -1){
|
||||||
close(pipein[0]);
|
close(pipein[0]);
|
||||||
close(pipein[1]);
|
close(pipein[1]);
|
||||||
}
|
}
|
||||||
if (*fdout == -1){
|
if (fdout && *fdout == -1){
|
||||||
close(pipeout[0]);
|
close(pipeout[0]);
|
||||||
close(pipeout[1]);
|
close(pipeout[1]);
|
||||||
}
|
}
|
||||||
if (*fderr == -1){
|
if (fderr && *fderr == -1){
|
||||||
close(pipeerr[0]);
|
close(pipeerr[0]);
|
||||||
close(pipeerr[1]);
|
close(pipeerr[1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue