Re: [PATCH 11/12] mprotect.2: Use "%p" rather than casting to 'long' when printing adresses (pointer values)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/12/20 1:14 AM, Alejandro Colomar wrote:
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>

Thanks, Alex. Patch applied.

Cheers,

Michael


> ---
>  man2/mprotect.2 | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/man2/mprotect.2 b/man2/mprotect.2
> index 47d250303..885238a8d 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)
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux