busybox: ignore fstab option "nofail"
[opendreambox.git] / meta-opendreambox / recipes-core / busybox / busybox-1.20.2 / 0008-udhcpc-obtain-hostname-from-OS-by-default.patch
1 From 1fd8cad8f4bed419722765080af625cbe7597298 Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Tue, 15 Jan 2013 17:33:53 +0100
4 Subject: [PATCH 8/9] udhcpc: obtain hostname from OS by default
5
6 * Doesn't require the 'hostname' option in /etc/network/interfaces,
7   and thus makes udhcpc behave like other clients.
8
9 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
10 ---
11  networking/udhcp/dhcpc.c |    9 +++++++++
12  1 file changed, 9 insertions(+)
13
14 diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
15 index 5a6c220..a9f9edd 100644
16 --- a/networking/udhcp/dhcpc.c
17 +++ b/networking/udhcp/dhcpc.c
18 @@ -1333,6 +1333,15 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
19                 logmode |= LOGMODE_SYSLOG;
20         }
21  
22 +       /* try to get hostname from OS */
23 +       if (!client_config.hostname) {
24 +               char hostname[256];     /* SUSv2: hostnames are <= 255 bytes */
25 +               if (gethostname(hostname, sizeof(hostname)) == 0) {
26 +                       hostname[sizeof(hostname) - 1] = '\0';
27 +                       client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, hostname, 0);
28 +               }
29 +       }
30 +
31         /* Make sure fd 0,1,2 are open */
32         bb_sanitize_stdio();
33         /* Equivalent of doing a fflush after every \n */
34 -- 
35 1.7.10.4
36