From: Florian Forster Date: Thu, 17 Dec 2015 13:21:27 +0000 (+0100) Subject: gmond plugin: Check return value of setsockopt(2). X-Git-Tag: collectd-5.5.1~12^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0ea11b520f610d0ed8fc34f50a7880c3c78c4186;p=collectd.git gmond plugin: Check return value of setsockopt(2). CID: 38112 --- diff --git a/src/gmond.c b/src/gmond.c index a1fa9ea4..99d1334b 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -286,8 +286,14 @@ static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */ { int yes = 1; - setsockopt (sockets[sockets_num].fd, SOL_SOCKET, SO_REUSEADDR, + status = setsockopt (sockets[sockets_num].fd, SOL_SOCKET, SO_REUSEADDR, (void *) &yes, sizeof (yes)); + if (status != 0) + { + char errbuf[1024]; + WARNING ("gmond plugin: setsockopt(2) failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + } } status = bind (sockets[sockets_num].fd, ai_ptr->ai_addr, ai_ptr->ai_addrlen);