git: 9364edfdf092 - main - net-mgmt/net-snmp: Fix scenario where a user does not have a config in the default location

From: Ryan Steinmetz <zi_at_FreeBSD.org>
Date: Fri, 19 Jul 2024 18:04:37 UTC
The branch main has been updated by zi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9364edfdf092ee1edc0401518e89d0340ef535ca

commit 9364edfdf092ee1edc0401518e89d0340ef535ca
Author:     Ryan Steinmetz <zi@FreeBSD.org>
AuthorDate: 2024-07-19 18:03:04 +0000
Commit:     Ryan Steinmetz <zi@FreeBSD.org>
CommitDate: 2024-07-19 18:04:28 +0000

    net-mgmt/net-snmp: Fix scenario where a user does not have a config in the default location
    
    PR:             280284
    Reported by:    gebhart@secnetix.de
---
 net-mgmt/net-snmp/Makefile       | 2 +-
 net-mgmt/net-snmp/files/snmpd.in | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile
index e6b4d2ba83d9..e7558608e1b8 100644
--- a/net-mgmt/net-snmp/Makefile
+++ b/net-mgmt/net-snmp/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	snmp
 PORTVERSION=	5.9.4
 PORTEPOCH=	1
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	net-mgmt
 MASTER_SITES=	SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} \
 		ZI
diff --git a/net-mgmt/net-snmp/files/snmpd.in b/net-mgmt/net-snmp/files/snmpd.in
index 575086a381cd..b3e02f1a5586 100644
--- a/net-mgmt/net-snmp/files/snmpd.in
+++ b/net-mgmt/net-snmp/files/snmpd.in
@@ -77,7 +77,10 @@ net_snmpd_precmd() {
 	done
 
 	# -c does not override the default config file.
-	check_conffile %%PREFIX%%/share/snmp/snmpd.conf
+	# if it exists, sanity check
+	if [ -f %%PREFIX%%/share/snmp/snmpd.conf ]; then
+		check_conffile %%PREFIX%%/share/snmp/snmpd.conf
+	fi
 	for conffile in ${snmpd_conffile}; do
 		check_conffile ${conffile}
 		if [ -f "${conffile}" -a -s "${conffile}" ]; then