aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2021-09-14 14:02:08 +0800
committerKhem Raj <raj.khem@gmail.com>2021-09-14 08:18:45 -0700
commit4ed048fb055ca3fd91d2c7fe128f6d67b772aa25 (patch)
tree81ab0798e7c3e76d1aad09848a7e43018c329d7d
parentce4c2b73828d79e251f688a8bb7fcdb7a0c1fa0a (diff)
downloadmeta-openembedded-contrib-4ed048fb055ca3fd91d2c7fe128f6d67b772aa25.tar.gz
meta-openembedded-contrib-4ed048fb055ca3fd91d2c7fe128f6d67b772aa25.tar.bz2
meta-openembedded-contrib-4ed048fb055ca3fd91d2c7fe128f6d67b772aa25.zip
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>
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch55
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb1
2 files changed, 56 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch
new file mode 100644
index 0000000000..4fc9e54b49
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch
@@ -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
+
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb
index 5fa6170940..e6ea2ddae5 100644
--- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb
@@ -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"