diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-04-28 14:11:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 14:11:24 +0300 |
commit | 59efd533768ccd1713ab2ddcad5ff1d1d724fd41 (patch) | |
tree | 35bc548638705ea9f951824d2db8086b31c56384 /streaming/receiver.c | |
parent | 3b3b2f1f93d7184e8e1a392c0de7be8566bbbf70 (diff) |
Check the return of setsockopt (#12772)
Diffstat (limited to 'streaming/receiver.c')
-rw-r--r-- | streaming/receiver.c | 3 |
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"); |