]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
bswap.3: Use strtoull() for parsing 64-bit numbers
authorJakub Wilk <jwilk@jwilk.net>
Fri, 11 Sep 2020 11:44:46 +0000 (13:44 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Fri, 11 Sep 2020 12:11:10 +0000 (14:11 +0200)
Before, on 32-bit systems:

    $ ./a.out 0x0123456789abcdef
    0xffffffff ==> 0xffffffff00000000

After:

    $ ./a.out 0x0123456789abcdef
    0x123456789abcdef ==> 0xefcdab8967452301

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/bswap.3

index 412e1702f52b3122f818862b818d093430320bf5..ce847580aa18342f5102202cb00c2481fa16a3f3 100644 (file)
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
-    x = strtoul(argv[1], NULL, 0);
+    x = strtoull(argv[1], NULL, 0);
     printf("0x%" PRIx64 " ==> 0x%" PRIx64 "\en", x, bswap_64(x));
 
     exit(EXIT_SUCCESS);