libc: Close all pipe file descriptors in popen() after dup2() is called
This commit is contained in:
parent
fe302f5967
commit
62cb53069c
@ -793,11 +793,13 @@ extern "C"
|
|||||||
{
|
{
|
||||||
close(pfds[0]);
|
close(pfds[0]);
|
||||||
dup2(pfds[1], STDOUT_FILENO);
|
dup2(pfds[1], STDOUT_FILENO);
|
||||||
|
close(pfds[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
close(pfds[1]);
|
close(pfds[1]);
|
||||||
dup2(pfds[0], STDIN_FILENO);
|
dup2(pfds[0], STDIN_FILENO);
|
||||||
|
close(pfds[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
execl("/bin/sh", "sh", "-c", command, nullptr);
|
execl("/bin/sh", "sh", "-c", command, nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user