diff options
| author | Alejandro Colomar <colomar.6.4.3@gmail.com> | 2020-09-12 01:14:11 +0200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2020-09-13 08:06:46 +0200 |
| commit | 982dfed192b9bcdf24aec84bad7639b28833bc0e (patch) | |
| tree | 2c204afc38b11dd50eb518d59ea0aec8427b0893 | |
| parent | 627a256ed6c082264d6db8f4ec8dfe1d7f3c4b6e (diff) | |
| download | man-pages-982dfed192b9bcdf24aec84bad7639b28833bc0e.tar.gz | |
mprotect.2: Use "%p" rather than casting to 'long' when printing pointer values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man2/mprotect.2 | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/man2/mprotect.2 b/man2/mprotect.2 index 47d2503035..885238a8df 100644 --- a/man2/mprotect.2 +++ b/man2/mprotect.2 @@ -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) |
