hostid: do not output sign-extended host id. Closes 6056
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 4 Mar 2013 02:04:38 +0000 (03:04 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 4 Mar 2013 02:04:38 +0000 (03:04 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/hostid.c

index 5c1a4e0861751d3e727a6fc48c4f386f46d8dd4d..e5b1f51883aec008fad29d2f71f68220e63e1821 100644 (file)
@@ -36,7 +36,8 @@ int hostid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                bb_show_usage();
        }
 
-       printf("%08lx\n", gethostid());
+       /* POSIX says gethostid returns a "32-bit identifier" */
+       printf("%08x\n", (unsigned)(uint32_t)gethostid());
 
        return fflush_all();
 }