aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPere Orga <gotrunks@gmail.com>2011-08-11 13:42:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-08-16 23:36:10 +0200
commitb1611d9a4693f1dc8296ef44f7e0f6044032ce15 (patch)
treeb3418ea24db0353d10c1e46cd3e4cd51af61f88f
parent4619802a5f399119345ca339886b7b060f2c15aa (diff)
downloadbusybox-w32-b1611d9a4693f1dc8296ef44f7e0f6044032ce15.tar.gz
busybox-w32-b1611d9a4693f1dc8296ef44f7e0f6044032ce15.tar.bz2
busybox-w32-b1611d9a4693f1dc8296ef44f7e0f6044032ce15.zip
hostid: fix behavior on identifiers starting with zeros
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/Config.src7
-rw-r--r--coreutils/Kbuild.src1
-rw-r--r--coreutils/hostid.c13
-rw-r--r--include/applets.src.h1
4 files changed, 12 insertions, 10 deletions
diff --git a/coreutils/Config.src b/coreutils/Config.src
index 65165d79b..a28449b11 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -269,13 +269,6 @@ config FEATURE_FANCY_HEAD
269 help 269 help
270 This enables the head options (-c, -q, and -v). 270 This enables the head options (-c, -q, and -v).
271 271
272config HOSTID
273 bool "hostid"
274 default y
275 help
276 hostid prints the numeric identifier (in hexadecimal) for
277 the current host.
278
279config INSTALL 272config INSTALL
280 bool "install" 273 bool "install"
281 default y 274 default y
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 53d88b391..d6453f014 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -36,7 +36,6 @@ lib-$(CONFIG_FALSE) += false.o
36lib-$(CONFIG_FOLD) += fold.o 36lib-$(CONFIG_FOLD) += fold.o
37lib-$(CONFIG_FSYNC) += fsync.o 37lib-$(CONFIG_FSYNC) += fsync.o
38lib-$(CONFIG_HEAD) += head.o 38lib-$(CONFIG_HEAD) += head.o
39lib-$(CONFIG_HOSTID) += hostid.o
40lib-$(CONFIG_INSTALL) += install.o 39lib-$(CONFIG_INSTALL) += install.o
41#lib-$(CONFIG_LENGTH) += length.o 40#lib-$(CONFIG_LENGTH) += length.o
42lib-$(CONFIG_LN) += ln.o 41lib-$(CONFIG_LN) += ln.o
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index 49409b9de..5c1a4e086 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -9,6 +9,17 @@
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 11
12//config:config HOSTID
13//config: bool "hostid"
14//config: default y
15//config: help
16//config: hostid prints the numeric identifier (in hexadecimal) for
17//config: the current host.
18
19//applet:IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
20
21//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
22
12//usage:#define hostid_trivial_usage 23//usage:#define hostid_trivial_usage
13//usage: "" 24//usage: ""
14//usage:#define hostid_full_usage "\n\n" 25//usage:#define hostid_full_usage "\n\n"
@@ -25,7 +36,7 @@ int hostid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
25 bb_show_usage(); 36 bb_show_usage();
26 } 37 }
27 38
28 printf("%lx\n", gethostid()); 39 printf("%08lx\n", gethostid());
29 40
30 return fflush_all(); 41 return fflush_all();
31} 42}
diff --git a/include/applets.src.h b/include/applets.src.h
index 87d9cbb7b..a5866d83b 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -176,7 +176,6 @@ IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
176IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP)) 176IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP))
177IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head)) 177IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
178IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) 178IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
179IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
180IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) 179IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
181IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 180IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
182IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) 181IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))