Re: [PATCH] wfix: sigaltstack(2) example: function pointer

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

 



Hi Jan,

On Wed, Nov 29, 2023 at 02:13:59PM +0100, Jan Kasprzak wrote:
> In the following example code:
> 
>     sa.sa_handler = handler();      /* Address of a signal handler */
> 
> we expect to use a function pointer instead of actually calling a function
> named handler(). So the parentheses in the above are superfluous.

s/superfluous/wrong/

> (Unless there is a function named "handler" returning a pointer to some
> _other_ function, of course).
> 
> Signed-off-by: Jan "Yenya" Kasprzak <kas@xxxxxxxxxx>

Thanks,
Alex

> ---
>  man2/sigaltstack.2 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man2/sigaltstack.2 b/man2/sigaltstack.2
> index bd5e6ab..d88d490 100644
> --- a/man2/sigaltstack.2
> +++ b/man2/sigaltstack.2
> @@ -345,7 +345,7 @@ if (sigaltstack(&ss, NULL) == \-1) {
>  }
>  \&
>  sa.sa_flags = SA_ONSTACK;
> -sa.sa_handler = handler();      /* Address of a signal handler */
> +sa.sa_handler = handler;      /* Address of a signal handler */
>  sigemptyset(&sa.sa_mask);
>  if (sigaction(SIGSEGV, &sa, NULL) == \-1) {
>      perror("sigaction");
> -- 
> 1.8.3.1
> 
> 
> -- 
> | Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
> | https://www.fi.muni.cz/~kas/                        GPG: 4096R/A45477D5 |
>     We all agree on the necessity of compromise. We just can't agree on
>     when it's necessary to compromise.                     --Larry Wall

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[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