Skip to content

Commit

Permalink
Do not use signal when using lwIP
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
NeroReflex authored and Denis Benato committed Jan 14, 2025
1 parent 443d508 commit 5bfdf43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MQTTClient-C/src/linux/MQTTLinuxNetwork.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ static int linux_write(Network* n, unsigned char* buffer, int len, int timeout_m

void NetworkInit(Network* n)
{
#if !defined(LWIP_SOCKET)
signal(SIGPIPE, SIG_IGN);
#endif
n->my_socket = 0;
n->mqttread = linux_read;
n->mqttwrite = linux_write;
Expand Down
2 changes: 2 additions & 0 deletions MQTTClient/src/linux/linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class IPStack
public:
IPStack()
{
#if !defined(LWIP_SOCKET)
signal(SIGPIPE, SIG_IGN);
#endif
}

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

0 comments on commit 5bfdf43

Please sign in to comment.