From 20edd64301ca0bd2147dc86035801dfdce383780 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 15 Mar 2017 21:28:53 +0900 Subject: [PATCH] nghttpx: Handle return value of write(2) --- src/shrpx_exec.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shrpx_exec.cc b/src/shrpx_exec.cc index 09864dd8..efff4d68 100644 --- a/src/shrpx_exec.cc +++ b/src/shrpx_exec.cc @@ -85,7 +85,8 @@ int exec_read_command(Process &proc, char *const argv[]) { rv = shrpx_signal_unblock_all(); if (rv != 0) { constexpr char msg[] = "Unblocking all signals failed\n"; - write(STDERR_FILENO, msg, str_size(msg)); + while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR) + ; nghttp2_Exit(EXIT_FAILURE); } @@ -95,7 +96,8 @@ int exec_read_command(Process &proc, char *const argv[]) { rv = execv(argv[0], argv); if (rv == -1) { constexpr char msg[] = "Could not execute command\n"; - write(STDERR_FILENO, msg, str_size(msg)); + while (write(STDERR_FILENO, msg, str_size(msg)) == -1 && errno == EINTR) + ; nghttp2_Exit(EXIT_FAILURE); } // unreachable