aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch')
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch55
1 files changed, 55 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 000000000..4fc9e54b4
--- /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
+