Hi,

On Wed, Mar 16, 2016 at 12:03 PM, Jens Rehsack <[email protected]> wrote:
>
> Doesn't require the 'hostname' option in /etc/network/interfaces, and thus
> makes udhcpc behave like other clients.

Sounds sensible to me.

> +++ b/networking/udhcp/dhcpc.c
> @@ -1405,6 +1405,18 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
>                 logmode |= LOGMODE_SYSLOG;
>         }
>
> +       /* try to get hostname from OS */
> +       if (!client_config.hostname) {
> +               char *hostname = safe_gethostname();

Have you tried simply initializing client_config.hostname to the
hostname and move alloc_dhcp_option further down? It might end up with
smaller code.

> +               /*
> +                * Tito's safe_gethostname is finally a 
> "safe_visible_gethostname",
> +                * but that's the most seen use-case.
> +                */
> +               if (hostname[0] && hostname[0] != '?')

safe_gethostname() already ensures that hostname[0] isn't 0, so the
first check can be removed.

-- 
Bye, Peter Korsgaard
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to