mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-01 13:58:06 +00:00
net-snmp: make sure snmpd always exit after displaying usage
Currently, viewing the help text with snmpd -h results in snmpd being started in the background. $ snmpd -h Usage: snmpd [OPTIONS] [LISTENING ADDRESSES] [snip] $ ps -ef | grep snmpd root 1477 1 0 05:46 ? 00:00:00 snmpd -h Backport a patch to fix this issue. Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
ce4c2b7382
commit
4ed048fb05
|
|
@ -0,0 +1,55 @@
|
|||
From 94ca941e06bef157bf0e13251f8ca1471daa9393 Mon Sep 17 00:00:00 2001
|
||||
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
|
||||
Date: Fri, 27 Aug 2021 14:21:45 +0300
|
||||
Subject: [PATCH] snmpd: always exit after displaying usage
|
||||
|
||||
Currently, viewing the help text with -h results in snmpd being started
|
||||
in the background, whereas this does not happen with --help. Similarly,
|
||||
when an error is detected in command line syntax, the help text is
|
||||
displayed but sometimes snmpd gets started anyway, depending on the
|
||||
execution path.
|
||||
|
||||
This patch makes snmpd consistently terminate whenever the usage
|
||||
function gets called. It also removes the goto statements no longer
|
||||
needed.
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/net-snmp/net-snmp/commit/94ca941e06bef157bf0e13251f8ca1471daa9393]
|
||||
|
||||
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
|
||||
---
|
||||
agent/snmpd.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/agent/snmpd.c b/agent/snmpd.c
|
||||
index f5aab0af8..90de12d99 100644
|
||||
--- a/agent/snmpd.c
|
||||
+++ b/agent/snmpd.c
|
||||
@@ -289,6 +289,8 @@ usage(char *prog)
|
||||
" -S d|i|0-7\t\tuse -Ls <facility> instead\n"
|
||||
"\n"
|
||||
);
|
||||
+ SOCK_CLEANUP;
|
||||
+ exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -494,7 +496,6 @@ main(int argc, char *argv[])
|
||||
case '-':
|
||||
if (strcasecmp(optarg, "help") == 0) {
|
||||
usage(argv[0]);
|
||||
- goto out;
|
||||
}
|
||||
if (strcasecmp(optarg, "version") == 0) {
|
||||
version();
|
||||
@@ -783,7 +784,6 @@ main(int argc, char *argv[])
|
||||
fprintf(stderr, "%s: Illegal argument -X:"
|
||||
"AgentX support not compiled in.\n", argv[0]);
|
||||
usage(argv[0]);
|
||||
- goto out;
|
||||
#endif
|
||||
break;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
|
|
@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \
|
|||
file://net-snmp-fix-for-disable-des.patch \
|
||||
file://reproducibility-have-printcap.patch \
|
||||
file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \
|
||||
file://0001-snmpd-always-exit-after-displaying-usage.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "eb7fd4a44de6cddbffd9a92a85ad1309e5c1054fb9d5a7dd93079c8953f48c3f"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user