diff options
-rw-r--r-- | networking/hostname.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/hostname.c b/networking/hostname.c index d2516b5fb..b3e352242 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -106,7 +106,7 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) | |||
106 | OPT_i = 0x4, | 106 | OPT_i = 0x4, |
107 | OPT_s = 0x8, | 107 | OPT_s = 0x8, |
108 | OPT_F = 0x10, | 108 | OPT_F = 0x10, |
109 | OPT_dfis = 0xf, | 109 | OPT_dfi = 0x7, |
110 | }; | 110 | }; |
111 | 111 | ||
112 | unsigned opts; | 112 | unsigned opts; |
@@ -134,7 +134,7 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) | |||
134 | if (applet_name[0] == 'd') /* dnsdomainname? */ | 134 | if (applet_name[0] == 'd') /* dnsdomainname? */ |
135 | opts = OPT_d; | 135 | opts = OPT_d; |
136 | 136 | ||
137 | if (opts & OPT_dfis) { | 137 | if (opts & OPT_dfi) { |
138 | /* Cases when we need full hostname (or its part) */ | 138 | /* Cases when we need full hostname (or its part) */ |
139 | struct hostent *hp; | 139 | struct hostent *hp; |
140 | char *p; | 140 | char *p; |
@@ -159,6 +159,9 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) | |||
159 | bb_putchar('\n'); | 159 | bb_putchar('\n'); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } else if (opts & OPT_s) { | ||
163 | strchrnul(buf, '.')[0] = '\0'; | ||
164 | puts(buf); | ||
162 | } else if (opts & OPT_F) { | 165 | } else if (opts & OPT_F) { |
163 | /* Set the hostname */ | 166 | /* Set the hostname */ |
164 | do_sethostname(hostname_str, 1); | 167 | do_sethostname(hostname_str, 1); |