mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Close pipe if fork() fails when spawning processes
Prevents potential file descriptor leakage, albeit in a bit of an edge case.
This commit is contained in:
parent
6163be687d
commit
5cbbfd5c8a
@ -82,6 +82,8 @@ inline FILE* open(const std::string& cmd, int& pid) {
|
|||||||
|
|
||||||
if (child_pid < 0) {
|
if (child_pid < 0) {
|
||||||
spdlog::error("Unable to exec cmd {}, error {}", cmd.c_str(), strerror(errno));
|
spdlog::error("Unable to exec cmd {}, error {}", cmd.c_str(), strerror(errno));
|
||||||
|
::close(fd[0]);
|
||||||
|
::close(fd[1]);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user