1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

gcc: pipe error path

Close opened descriptors on failed fork path.
This commit is contained in:
Zdenek Kabelac 2024-06-16 15:15:44 +02:00
parent 64ccbc4b52
commit b1d80a0ffd

View File

@ -164,7 +164,11 @@ FILE *pipe_open(struct cmd_context *cmd, const char *const argv[],
log_verbose("Piping:%s", _verbose_args(argv, buf, sizeof(buf)));
if ((pdata->pid = fork()) == -1) {
log_sys_error("pipe", "");
log_sys_error("fork", "");
if (close(pipefd[0]))
log_sys_debug("close", "STDOUT");
if (close(pipefd[1]))
log_sys_debug("close", "STDIN");
return 0;
}