Skip to content

Commit

Permalink
gcc: pipe error path
Browse files Browse the repository at this point in the history
Close opened descriptors on failed fork path.
  • Loading branch information
Zdenek Kabelac committed Jun 19, 2024
1 parent 64ccbc4 commit b1d80a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/misc/lvm-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b1d80a0

Please sign in to comment.