Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 2017 17:26:13 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315642 - head/contrib/bsnmp/lib
Message-ID:  <201703201726.v2KHQDPH031014@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Mar 20 17:26:13 2017
New Revision: 315642
URL: https://svnweb.freebsd.org/changeset/base/315642

Log:
  bsnmp: explicitly test the return value for open_client_{local,udp} in snmp_open(..)
  
  open_client_* returns -1 on failure; 0 on success. Ensure that the return value is
  0 -- otherwise exit snmp_open(..).
  
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Modified:
  head/contrib/bsnmp/lib/snmpclient.c

Modified: head/contrib/bsnmp/lib/snmpclient.c
==============================================================================
--- head/contrib/bsnmp/lib/snmpclient.c	Mon Mar 20 17:17:54 2017	(r315641)
+++ head/contrib/bsnmp/lib/snmpclient.c	Mon Mar 20 17:26:13 2017	(r315642)
@@ -1068,13 +1068,13 @@ snmp_open(const char *host, const char *
 	switch (snmp_client.trans) {
 
 	  case SNMP_TRANS_UDP:
-		if (open_client_udp(host, port))
+		if (open_client_udp(host, port) != 0)
 			return (-1);
 		break;
 
 	  case SNMP_TRANS_LOC_DGRAM:
 	  case SNMP_TRANS_LOC_STREAM:
-		if (open_client_local(host))
+		if (open_client_local(host) != 0)
 			return (-1);
 		break;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703201726.v2KHQDPH031014>