Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jul 2025 16:01:47 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 44836e3277af - main - bsnmpget: print SNMP library reported error on failures
Message-ID:  <202507171601.56HG1lko032805@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=44836e3277af1f272a409b8d5806c67a9dbb9cb0

commit 44836e3277af1f272a409b8d5806c67a9dbb9cb0
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-07-17 16:00:15 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-07-17 16:00:15 +0000

    bsnmpget: print SNMP library reported error on failures
    
    Reviewed by:            syrinx, harti
    Differential Revision:  https://reviews.freebsd.org/D51073
---
 usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
index 9d5a693c7c68..9252e63749bb 100644
--- a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
+++ b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
@@ -1179,8 +1179,10 @@ main(int argc, char ** argv)
 		/* On -h (help) exit without error. */
 		if (opt_num == -2)
 			exit(0);
-		else
+		else {
+			fprintf(stderr, "Error: %s\n", snmp_client.error);
 			exit(1);
+		}
 	}
 
 	oid_cnt = argc - opt_num - 1;
@@ -1239,7 +1241,7 @@ main(int argc, char ** argv)
 	}
 
 	if (snmp_open(NULL, NULL, NULL, NULL)) {
-		warn("Failed to open snmp session");
+		fprintf(stderr, "snmp_open(3): %s\n", snmp_client.error);
 		snmp_tool_freeall(&snmptoolctx);
 		exit(1);
 	}



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