Skip to content

Commit

Permalink
Ignore SIGPIPE on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
icraggs committed Jun 7, 2023
1 parent ab85141 commit d8ec817
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion MQTTClient-C/src/linux/MQTTLinux.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2017 IBM Corp.
* Copyright (c) 2014, 2023 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -107,6 +107,7 @@ int linux_write(Network* n, unsigned char* buffer, int len, int timeout_ms)

void NetworkInit(Network* n)
{
signal(SIGPIPE, SIG_IGN);
n->my_socket = 0;
n->mqttread = linux_read;
n->mqttwrite = linux_write;
Expand Down
4 changes: 2 additions & 2 deletions MQTTClient/src/linux/linux.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2017 IBM Corp.
* Copyright (c) 2014, 2023 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -39,7 +39,7 @@ class IPStack
public:
IPStack()
{

signal(SIGPIPE, SIG_IGN);
}

int connect(const char* hostname, int port)
Expand Down

0 comments on commit d8ec817

Please sign in to comment.