mirror of
https://github.com/AGWA/git-crypt.git
synced 2026-01-03 08:37:57 -08:00
Plug a file descriptor leak if fork() fails
(Not that we really care if that happens ;-) but it's good to be correct.)
This commit is contained in:
5
util.cpp
5
util.cpp
@@ -112,7 +112,10 @@ int exec_command (const char* command, std::ostream& output)
|
||||
}
|
||||
pid_t child = fork();
|
||||
if (child == -1) {
|
||||
throw System_error("fork", "", errno);
|
||||
int fork_errno = errno;
|
||||
close(pipefd[0]);
|
||||
close(pipefd[1]);
|
||||
throw System_error("fork", "", fork_errno);
|
||||
}
|
||||
if (child == 0) {
|
||||
close(pipefd[0]);
|
||||
|
||||
Reference in New Issue
Block a user