From: Michael Pfeifroth Date: Mon, 22 Jun 2026 15:05:07 +0000 (+0200) Subject: net-snmp: fix 'bad number' warning when engineidtype is unset X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=d5a0672d6a015043f26eaa8585a824cecd2a72ee;p=openwrt-packages.git net-snmp: fix 'bad number' warning when engineidtype is unset Add a -n guard before the arithmetic comparison of engineidtype in snmpd_engineid_add(). When the engineid UCI section exists but engineidtype is not configured, the empty string is passed to [ -ge ]/[ -le ] which causes 'sh: bad number' on every boot. Signed-off-by: Michael Pfeifroth --- diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init index 4e3db12ef..a602711ea 100644 --- a/net/net-snmp/files/snmpd.init +++ b/net/net-snmp/files/snmpd.init @@ -240,7 +240,7 @@ snmpd_engineid_add() { config_get engineid "$cfg" engineid [ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE config_get engineidtype "$cfg" engineidtype - [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \ + [ -n "$engineidtype" ] && [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \ echo "engineIDType $engineidtype" >> $CONFIGFILE config_get engineidnic "$cfg" engineidnic [ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE