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 5c1a4e0..e5b1f51 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();
 }