Skip to content

Commit

Permalink
linux: ignore EPIPE for hooks
Browse files Browse the repository at this point in the history
ignore EPIPE when writing to the hook stdin, as the hook process could
already have been terminated.

Closes: #1551

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 5, 2024
1 parent 841a0de commit 2c4db99
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libcrun/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1671,8 +1671,13 @@ run_process_with_stdin_timeout_envp (char *path, char **args, const char *cwd, i
ret = TEMP_FAILURE_RETRY (write (pipe_w, stdin, stdin_len));
if (UNLIKELY (ret < 0))
{
ret = crun_make_error (err, errno, "writing to pipe");
goto restore_sig_mask_and_exit;
/* Ignore EPIPE as the container process could have already
been terminated. */
if (errno != EPIPE)
{
ret = crun_make_error (err, errno, "writing to pipe");
goto restore_sig_mask_and_exit;
}
}

close_and_reset (&pipe_w);
Expand Down

0 comments on commit 2c4db99

Please sign in to comment.