aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-12-10 08:47:29 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-09 15:50:24 +0100
commit51f035aa3f2978709a531d46db07e28aec682020 (patch)
treed256710177fdf61f243645d3abd67707eb69b6a5
parentedc7b96b2fe130dc4e9565781ec5911c876eccf0 (diff)
downloadlibssh-51f035aa3f2978709a531d46db07e28aec682020.tar.gz
libssh-51f035aa3f2978709a531d46db07e28aec682020.tar.xz
libssh-51f035aa3f2978709a531d46db07e28aec682020.zip
poll: Do not generate SIGPIPE with recv() in bsd_poll()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/poll.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index e3f5262e..01eb42d5 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -172,14 +172,19 @@ static short bsd_socket_compute_revents(int fd, short events)
int sock_errno = errno;
char data[64] = {0};
short revents = 0;
+ int flags = MSG_PEEK;
int ret;
+#ifdef MSG_NOSIGNAL
+ flags |= MSG_NOSIGNAL;
+#endif
+
/* support for POLLHUP */
#ifdef _WIN32
WSASetLastError(0);
#endif
- ret = recv(fd, data, 64, MSG_PEEK);
+ ret = recv(fd, data, 64, flags);
errno = save_errno;