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
This commit is contained in:
Enji Cooper 2017-03-20 17:26:13 +00:00
parent 7583dc2785
commit 295685c5c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315642

View File

@ -1068,13 +1068,13 @@ snmp_open(const char *host, const char *port, const char *readcomm,
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;