Use send/sendmsg and don't ignore SIGPIPE
This commit is contained in:
@@ -300,7 +300,7 @@ struct Connection {
|
||||
bool writeBytes() {
|
||||
for (;;) {
|
||||
assert(!request.empty());
|
||||
int w = write(fd, request.data(), request.size());
|
||||
int w = send(fd, request.data(), request.size(), MSG_NOSIGNAL);
|
||||
if (w == -1) {
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
@@ -610,7 +610,6 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
signal(SIGTERM, signal_handler);
|
||||
signal(SIGINT, signal_handler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user