dnsmasq: fix dhcp_option usage warning
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 4 May 2017 20:33:37 +0000 (22:33 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 4 May 2017 20:42:49 +0000 (22:42 +0200)
Don't display unnecessary dhcp_option usage warning in case
dhcp_option is empty

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
package/network/services/dnsmasq/files/dnsmasq.init

index 4291df2..e6ba732 100644 (file)
@@ -560,9 +560,10 @@ dhcp_option_add() {
        if [ -n "$list_len" ]; then
                config_list_foreach "$cfg" dhcp_option dhcp_option_append "$networkid" "$force"
        else
-               echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
                config_get dhcp_option "$cfg" dhcp_option
 
+               [ -n "$dhcp_option" ] && echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
+
                local option
                for option in $dhcp_option; do
                        dhcp_option_append "$option" "$networkid" "$force"