summaryrefslogtreecommitdiff
path: root/networking/hostname.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-25 19:44:38 +0000
committerDenis Vlasenko2007-01-25 19:44:38 +0000
commit90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1 (patch)
tree6b577d9a4b26931daa5f24aa31bd1256aa39053b /networking/hostname.c
parentaeb4bdd582d6b11adcdb128d97076101c3c61f1d (diff)
downloadbusybox-90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1.zip
busybox-90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1.tar.gz
arping: stop using last gethostbyname2 in the tree
hostname: small optimization
Diffstat (limited to 'networking/hostname.c')
-rw-r--r--networking/hostname.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/networking/hostname.c b/networking/hostname.c
index 6d3b8eb..7116a14 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -48,11 +48,12 @@ int hostname_main(int argc, char **argv)
OPT_f = 0x2,
OPT_i = 0x4,
OPT_s = 0x8,
+ OPT_F = 0x8,
OPT_dfis = 0xf,
};
char buf[256];
- char *hostname_str = NULL;
+ char *hostname_str;
if (argc < 1)
bb_show_usage();
@@ -70,7 +71,7 @@ int hostname_main(int argc, char **argv)
puts(hp->h_name);
} else if (option_mask32 & OPT_s) {
if (p != NULL) {
- *p = 0;
+ *p = '\0';
}
puts(hp->h_name);
} else if (option_mask32 & OPT_d) {
@@ -84,7 +85,7 @@ int hostname_main(int argc, char **argv)
}
}
/* Set the hostname */
- else if (hostname_str != NULL) {
+ else if (option_mask32 & OPT_F) {
do_sethostname(hostname_str, 1);
} else if (optind < argc) {
do_sethostname(argv[optind], 0);