nghttpx: Handle return value of write(2)

This commit is contained in:
Tatsuhiro Tsujikawa 2017-03-15 21:28:53 +09:00
parent 9aee518352
commit 20edd64301
1 changed files with 4 additions and 2 deletions

View File

@ -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