summaryrefslogtreecommitdiffstats
path: root/streaming/receiver.c
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2022-04-28 14:11:24 +0300
committerGitHub <noreply@github.com>2022-04-28 14:11:24 +0300
commit59efd533768ccd1713ab2ddcad5ff1d1d724fd41 (patch)
tree35bc548638705ea9f951824d2db8086b31c56384 /streaming/receiver.c
parent3b3b2f1f93d7184e8e1a392c0de7be8566bbbf70 (diff)
Check the return of setsockopt (#12772)
Diffstat (limited to 'streaming/receiver.c')
-rw-r--r--streaming/receiver.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/streaming/receiver.c b/streaming/receiver.c
index 305934cc48..1fcef26ff9 100644
--- a/streaming/receiver.c
+++ b/streaming/receiver.c
@@ -612,7 +612,8 @@ static int rrdpush_receive(struct receiver_state *rpt)
struct timeval timeout;
timeout.tv_sec = 120;
timeout.tv_usec = 0;
- setsockopt (rpt->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
+ if (unlikely(setsockopt(rpt->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout) != 0))
+ error("STREAM %s [receive from [%s]:%s]: cannot set timeout for socket %d", rpt->host->hostname, rpt->client_ip, rpt->client_port, rpt->fd);
// convert the socket to a FILE *
FILE *fp = fdopen(rpt->fd, "r");