]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
mprotect.2: Use "%p" rather than casting to 'long' when printing pointer values
authorAlejandro Colomar <colomar.6.4.3@gmail.com>
Fri, 11 Sep 2020 23:14:11 +0000 (01:14 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sun, 13 Sep 2020 06:06:46 +0000 (08:06 +0200)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man2/mprotect.2

index 47d25030351149e7273f83b0122cf8aa80a06b6b..885238a8dfee735bd378a789a581fc21f1d9eec3 100644 (file)
@@ -326,8 +326,7 @@ handler(int sig, siginfo_t *si, void *unused)
        Nevertheless, we use printf() here as a simple way of
        showing that the handler was called. */
 
-    printf("Got SIGSEGV at address: %#lx\en",
-            (long) si\->si_addr);
+    printf("Got SIGSEGV at address: %p\en", si\->si_addr);
     exit(EXIT_FAILURE);
 }
 
@@ -354,7 +353,7 @@ main(int argc, char *argv[])
     if (buffer == NULL)
         handle_error("memalign");
 
-    printf("Start of region:        %#lx\en", (long) buffer);
+    printf("Start of region:        %p\en", buffer);
 
     if (mprotect(buffer + pagesize * 2, pagesize,
                 PROT_READ) == \-1)