git: 44836e3277af - main - bsnmpget: print SNMP library reported error on failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Jul 2025 16:01:47 UTC
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);
}