aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/nagios-plugins
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2015-10-08 12:14:37 +0000
committerMathieu Arnold <mat@FreeBSD.org>2015-10-08 12:14:37 +0000
commit3d33d2955a8dddb3575c1482e5611dfce5f98e93 (patch)
tree01aabac8af078be2303ccd7343f1250b2cdde219 /net-mgmt/nagios-plugins
parentcd72e8c3cc58eef4317cb7b223d250ee71e92719 (diff)
downloadports-3d33d2955a8dddb3575c1482e5611dfce5f98e93.tar.gz
ports-3d33d2955a8dddb3575c1482e5611dfce5f98e93.zip
Fix a regression where plugins would segfault if the monitored tcp port
is closed. PR: 203572 Submitted by: johan stromnet se Obtained from: https://github.com/stromnet/nagios-plugins/commit/a18f60cc610c690cc0756bc258b8202a1541a067 MFH: 2015Q4 Sponsored by: Absolight
Notes
Notes: svn path=/head/; revision=398816
Diffstat (limited to 'net-mgmt/nagios-plugins')
-rw-r--r--net-mgmt/nagios-plugins/Makefile2
-rw-r--r--net-mgmt/nagios-plugins/files/patch-plugins_netutils.c44
2 files changed, 45 insertions, 1 deletions
diff --git a/net-mgmt/nagios-plugins/Makefile b/net-mgmt/nagios-plugins/Makefile
index 3f8ff195cb2d..2c1fe10837ad 100644
--- a/net-mgmt/nagios-plugins/Makefile
+++ b/net-mgmt/nagios-plugins/Makefile
@@ -3,7 +3,7 @@
PORTNAME= nagios-plugins
PORTVERSION= 2.1.1
-PORTREVISION= 2
+PORTREVISION= 3
PORTEPOCH= 1
CATEGORIES= net-mgmt
MASTER_SITES= https://www.nagios-plugins.org/download/ \
diff --git a/net-mgmt/nagios-plugins/files/patch-plugins_netutils.c b/net-mgmt/nagios-plugins/files/patch-plugins_netutils.c
new file mode 100644
index 000000000000..b94e00358ba4
--- /dev/null
+++ b/net-mgmt/nagios-plugins/files/patch-plugins_netutils.c
@@ -0,0 +1,44 @@
+--- plugins/netutils.c.orig 2015-07-30 21:40:06 UTC
++++ plugins/netutils.c
+@@ -158,7 +158,7 @@ int
+ np_net_connect (const char *host_name, int port, int *sd, int proto)
+ {
+ struct addrinfo hints;
+- struct addrinfo *res;
++ struct addrinfo *res, *res0;
+ struct sockaddr_un su;
+ char port_str[6], host[MAX_HOST_ADDRESS_LENGTH];
+ size_t len;
+@@ -185,12 +185,13 @@ np_net_connect (const char *host_name, i
+ memcpy (host, host_name, len);
+ host[len] = '\0';
+ snprintf (port_str, sizeof (port_str), "%d", port);
+- result = getaddrinfo (host, port_str, &hints, &res);
++ result = getaddrinfo (host, port_str, &hints, &res0);
+
+ if (result != 0) {
+ printf ("%s\n", gai_strerror (result));
+ return STATE_UNKNOWN;
+ }
++ res = res0;
+
+ while (res) {
+ /* attempt to create a socket */
+@@ -198,7 +199,7 @@ np_net_connect (const char *host_name, i
+
+ if (*sd < 0) {
+ printf ("%s\n", _("Socket creation failed"));
+- freeaddrinfo (res);
++ freeaddrinfo (res0);
+ return STATE_UNKNOWN;
+ }
+
+@@ -221,7 +222,7 @@ np_net_connect (const char *host_name, i
+ close (*sd);
+ res = res->ai_next;
+ }
+- freeaddrinfo (res);
++ freeaddrinfo (res0);
+ }
+ /* else the hostname is interpreted as a path to a unix socket */
+ else {