hostid: fix behavior on identifiers starting with zeros
authorPere Orga <gotrunks@gmail.com>
Thu, 11 Aug 2011 11:42:00 +0000 (13:42 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 16 Aug 2011 21:36:10 +0000 (23:36 +0200)
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/Config.src
coreutils/Kbuild.src
coreutils/hostid.c
include/applets.src.h

index 65165d79bf59fc0b05c3d3783d8f73975d63f543..a28449b11d39aa8a3d646546c7cc3eecacaad4fd 100644 (file)
@@ -269,13 +269,6 @@ config FEATURE_FANCY_HEAD
        help
          This enables the head options (-c, -q, and -v).
 
-config HOSTID
-       bool "hostid"
-       default y
-       help
-         hostid prints the numeric identifier (in hexadecimal) for
-         the current host.
-
 config INSTALL
        bool "install"
        default y
index 53d88b391620c471bb4d6bec2bafafb426d6841e..d6453f014531c854618428723cc29121b169964c 100644 (file)
@@ -36,7 +36,6 @@ lib-$(CONFIG_FALSE)     += false.o
 lib-$(CONFIG_FOLD)      += fold.o
 lib-$(CONFIG_FSYNC)     += fsync.o
 lib-$(CONFIG_HEAD)      += head.o
-lib-$(CONFIG_HOSTID)    += hostid.o
 lib-$(CONFIG_INSTALL)   += install.o
 #lib-$(CONFIG_LENGTH)    += length.o
 lib-$(CONFIG_LN)        += ln.o
index 49409b9ded1b405fe3a6ae9fa42ca26ed29d34b8..5c1a4e0861751d3e727a6fc48c4f386f46d8dd4d 100644 (file)
@@ -9,6 +9,17 @@
 
 /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
 
+//config:config HOSTID
+//config:      bool "hostid"
+//config:      default y
+//config:      help
+//config:        hostid prints the numeric identifier (in hexadecimal) for
+//config:        the current host.
+
+//applet:IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
+
+//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
+
 //usage:#define hostid_trivial_usage
 //usage:       ""
 //usage:#define hostid_full_usage "\n\n"
@@ -25,7 +36,7 @@ int hostid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                bb_show_usage();
        }
 
-       printf("%lx\n", gethostid());
+       printf("%08lx\n", gethostid());
 
        return fflush_all();
 }
index 87d9cbb7b276871b3e0d37b23fbf7370861e2386..a5866d83b9446ab24e26b6c64164d2fbd5f772e7 100644 (file)
@@ -176,7 +176,6 @@ IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
 IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP))
 IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
 IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
-IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
 IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
 IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
 IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))