-
Notifications
You must be signed in to change notification settings - Fork 692
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main/mosquitto: backport upstream patch for SIGPIPE issue
See eclipse/mosquitto#2564 (cherry picked from commit 9292d10) (cherry picked from commit a83466b)
- Loading branch information
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
main/mosquitto/0001-Don-t-set-SIGPIPE-to-ignore-use-MSG_NOSIGNAL-instead.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
From 0c9d9f21633c5dbb482893a9d6bdf40111829925 Mon Sep 17 00:00:00 2001 | ||
From: "Roger A. Light" <[email protected]> | ||
Date: Sun, 7 Aug 2022 23:04:46 +0100 | ||
Subject: [PATCH] Don't set SIGPIPE to ignore, use MSG_NOSIGNAL instead. | ||
|
||
Closes #2564. Thanks to nmeum. | ||
--- | ||
lib/mosquitto.c | 4 ---- | ||
lib/net_mosq.c | 6 +----- | ||
lib/net_mosq.h | 5 +++++ | ||
4 files changed, 7 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/lib/mosquitto.c b/lib/mosquitto.c | ||
index 0d68d313..72762ed6 100644 | ||
--- a/lib/mosquitto.c | ||
+++ b/lib/mosquitto.c | ||
@@ -109,10 +109,6 @@ struct mosquitto *mosquitto_new(const char *id, bool clean_start, void *userdata | ||
return NULL; | ||
} | ||
|
||
-#ifndef WIN32 | ||
- signal(SIGPIPE, SIG_IGN); | ||
-#endif | ||
- | ||
mosq = (struct mosquitto *)mosquitto__calloc(1, sizeof(struct mosquitto)); | ||
if(mosq){ | ||
mosq->sock = INVALID_SOCKET; | ||
diff --git a/lib/net_mosq.c b/lib/net_mosq.c | ||
index 22f5a313..d4eb89ef 100644 | ||
--- a/lib/net_mosq.c | ||
+++ b/lib/net_mosq.c | ||
@@ -1041,11 +1041,7 @@ ssize_t net__write(struct mosquitto *mosq, const void *buf, size_t count) | ||
/* Call normal write/send */ | ||
#endif | ||
|
||
-#ifndef WIN32 | ||
- return write(mosq->sock, buf, count); | ||
-#else | ||
- return send(mosq->sock, buf, count, 0); | ||
-#endif | ||
+ return send(mosq->sock, buf, count, MSG_NOSIGNAL); | ||
|
||
#ifdef WITH_TLS | ||
} | ||
diff --git a/lib/net_mosq.h b/lib/net_mosq.h | ||
index 37a21461..ded98760 100644 | ||
--- a/lib/net_mosq.h | ||
+++ b/lib/net_mosq.h | ||
@@ -19,6 +19,7 @@ Contributors: | ||
#define NET_MOSQ_H | ||
|
||
#ifndef WIN32 | ||
+# include <sys/socket.h> | ||
# include <unistd.h> | ||
#else | ||
# include <winsock2.h> | ||
@@ -51,6 +52,10 @@ typedef SSIZE_T ssize_t; | ||
#define INVALID_SOCKET -1 | ||
#endif | ||
|
||
+#ifndef MSG_NOSIGNAL | ||
+# define MSG_NOSIGNAL 0 | ||
+#endif | ||
+ | ||
/* Macros for accessing the MSB and LSB of a uint16_t */ | ||
#define MOSQ_MSB(A) (uint8_t)((A & 0xFF00) >> 8) | ||
#define MOSQ_LSB(A) (uint8_t)(A & 0x00FF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# Maintainer: Natanael Copa <[email protected]> | ||
pkgname=mosquitto | ||
pkgver=2.0.14 | ||
pkgrel=0 | ||
pkgrel=1 | ||
pkgdesc="open source MQTT broker" | ||
url="https://mosquitto.org/" | ||
arch="all" | ||
|
@@ -15,6 +15,7 @@ checkdepends="python3 cunit-dev" | |
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-libs++:_pp $pkgname-openrc | ||
$pkgname-libs $pkgname-clients" | ||
source="http:https://mosquitto.org/files/source/mosquitto-$pkgver.tar.gz | ||
0001-Don-t-set-SIGPIPE-to-ignore-use-MSG_NOSIGNAL-instead.patch | ||
mosquitto.initd | ||
mosquitto.confd | ||
" | ||
|
@@ -106,6 +107,7 @@ clients() { | |
|
||
sha512sums=" | ||
a9e4f41b9af679b30318570e86a465546024651373df10e3b132f4593b89d22d0dbac01bb7371a57132ba030a2e73971c612acb5c9ac12f5ccd06aa38d9444c2 mosquitto-2.0.14.tar.gz | ||
d2ec296919ca9c3e31063b6b87c06c723f46347e5af4e92eaac8fe5c5d5e36faa90c8c3aa8911b3af2a470829bb032812dee57764581e1ac4da4e570b521639a 0001-Don-t-set-SIGPIPE-to-ignore-use-MSG_NOSIGNAL-instead.patch | ||
a527813957b6f2d7afdb7269bade61d99b3023a147861b38902971929ff342a7c8c276bdb808fcfe7e48fa3e5c7521a16d777e5a3313256b8bf1e759cec5b7b0 mosquitto.initd | ||
678a8aaefb9181f5f4998304046e5a8737049f90cf6bbbfd5fd4549592728afe77cb536547b39ad1598d53fe0b7c03e1506b2683e7b936712b9fad4a317f4b43 mosquitto.confd | ||
" |