Permalink
Browse files

Merge pull request #11475 from pleonex/fix-sigpipe

Ignore broken pipe / SIGPIPE signal to avoid crash
  • Loading branch information...
hrydgard committed Oct 17, 2018
2 parents 25230a1 + f5f9708 commit c514a27c81fee5acd7bc5a13af22c796229d49ab
Showing with 6 additions and 1 deletion.
  1. +6 −1 ext/native/base/buffer.cpp
@@ -13,6 +13,11 @@
#include <unistd.h>
#endif
#ifndef MSG_NOSIGNAL
// Default value to 0x00 (do nothing) in systems where it's not supported.
#define MSG_NOSIGNAL 0x00
#endif
#include "base/logging.h"
#include "base/timeutil.h"
#include "file/fd_util.h"
@@ -143,7 +148,7 @@ bool Buffer::FlushToFile(const char *filename) {
bool Buffer::FlushSocket(uintptr_t sock) {
for (size_t pos = 0, end = data_.size(); pos < end; ) {
int sent = send(sock, &data_[pos], (int)(end - pos), 0);
int sent = send(sock, &data_[pos], (int)(end - pos), MSG_NOSIGNAL);
if (sent < 0) {
ELOG("FlushSocket failed");
return false;

0 comments on commit c514a27

Please sign in to comment.