diff options
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmpd-always-exit-after-displaying-usage.patch | 55 | ||||
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.1.bb | 1 |
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 @@ | |||
1 | From 94ca941e06bef157bf0e13251f8ca1471daa9393 Mon Sep 17 00:00:00 2001 | ||
2 | From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | ||
3 | Date: Fri, 27 Aug 2021 14:21:45 +0300 | ||
4 | Subject: [PATCH] snmpd: always exit after displaying usage | ||
5 | |||
6 | Currently, viewing the help text with -h results in snmpd being started | ||
7 | in the background, whereas this does not happen with --help. Similarly, | ||
8 | when an error is detected in command line syntax, the help text is | ||
9 | displayed but sometimes snmpd gets started anyway, depending on the | ||
10 | execution path. | ||
11 | |||
12 | This patch makes snmpd consistently terminate whenever the usage | ||
13 | function gets called. It also removes the goto statements no longer | ||
14 | needed. | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | [https://github.com/net-snmp/net-snmp/commit/94ca941e06bef157bf0e13251f8ca1471daa9393] | ||
18 | |||
19 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
20 | --- | ||
21 | agent/snmpd.c | 4 ++-- | ||
22 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
23 | |||
24 | diff --git a/agent/snmpd.c b/agent/snmpd.c | ||
25 | index f5aab0af8..90de12d99 100644 | ||
26 | --- a/agent/snmpd.c | ||
27 | +++ b/agent/snmpd.c | ||
28 | @@ -289,6 +289,8 @@ usage(char *prog) | ||
29 | " -S d|i|0-7\t\tuse -Ls <facility> instead\n" | ||
30 | "\n" | ||
31 | ); | ||
32 | + SOCK_CLEANUP; | ||
33 | + exit(1); | ||
34 | } | ||
35 | |||
36 | static void | ||
37 | @@ -494,7 +496,6 @@ main(int argc, char *argv[]) | ||
38 | case '-': | ||
39 | if (strcasecmp(optarg, "help") == 0) { | ||
40 | usage(argv[0]); | ||
41 | - goto out; | ||
42 | } | ||
43 | if (strcasecmp(optarg, "version") == 0) { | ||
44 | version(); | ||
45 | @@ -783,7 +784,6 @@ main(int argc, char *argv[]) | ||
46 | fprintf(stderr, "%s: Illegal argument -X:" | ||
47 | "AgentX support not compiled in.\n", argv[0]); | ||
48 | usage(argv[0]); | ||
49 | - goto out; | ||
50 | #endif | ||
51 | break; | ||
52 | |||
53 | -- | ||
54 | 2.25.1 | ||
55 | |||
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 \ | |||
27 | file://net-snmp-fix-for-disable-des.patch \ | 27 | file://net-snmp-fix-for-disable-des.patch \ |
28 | file://reproducibility-have-printcap.patch \ | 28 | file://reproducibility-have-printcap.patch \ |
29 | file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ | 29 | file://0001-ac_add_search_path.m4-keep-consistent-between-32bit.patch \ |
30 | file://0001-snmpd-always-exit-after-displaying-usage.patch \ | ||
30 | " | 31 | " |
31 | SRC_URI[sha256sum] = "eb7fd4a44de6cddbffd9a92a85ad1309e5c1054fb9d5a7dd93079c8953f48c3f" | 32 | SRC_URI[sha256sum] = "eb7fd4a44de6cddbffd9a92a85ad1309e5c1054fb9d5a7dd93079c8953f48c3f" |
32 | 33 | ||