From: Florian Forster Date: Wed, 19 Jul 2006 16:41:36 +0000 (+0200) Subject: apcups plugin: Close the socket when `connect' failes. X-Git-Tag: collectd-3.10.1~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=90e12ab9258573aa46651640ecdbfaf24812068e;p=collectd.git apcups plugin: Close the socket when `connect' failes. Otherwise people will get `Too many open files' faily soon. --- diff --git a/src/apcups.c b/src/apcups.c index 9117bdae..f7486f5f 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -208,6 +208,7 @@ static int net_open (char *host, char *service, int port) if (status != 0) /* `connect(2)' failed */ { DBG ("connect failed: %s", strerror (errno)); + close (sd); return (-1); }