Skip to content

Commit 5bfdf43

Browse files
NeroReflexDenis Benato
authored andcommitted
Do not use signal when using lwIP
The lwIP library does not generate SIGPIPE and platforms supporting lwIP might not have a valid implementation of signal: avoid using signal in these circumstances. Signed-off-by: Denis Benato <[email protected]>
1 parent 443d508 commit 5bfdf43

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

MQTTClient-C/src/linux/MQTTLinuxNetwork.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ static int linux_write(Network* n, unsigned char* buffer, int len, int timeout_m
6666

6767
void NetworkInit(Network* n)
6868
{
69+
#if !defined(LWIP_SOCKET)
6970
signal(SIGPIPE, SIG_IGN);
71+
#endif
7072
n->my_socket = 0;
7173
n->mqttread = linux_read;
7274
n->mqttwrite = linux_write;

MQTTClient/src/linux/linux.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class IPStack
3939
public:
4040
IPStack()
4141
{
42+
#if !defined(LWIP_SOCKET)
4243
signal(SIGPIPE, SIG_IGN);
44+
#endif
4345
}
4446

4547
int connect(const char* hostname, int port)

0 commit comments

Comments
 (0)