Linux-man Archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Jan Kasprzak <kas@fi.muni.cz>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH] wfix: sigaltstack(2) example: function pointer
Date: Wed, 29 Nov 2023 14:32:15 +0100	[thread overview]
Message-ID: <ZWc9X9lLr728N26x@debian> (raw)
In-Reply-To: <20231129131359.GH18109@fi.muni.cz>

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

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@fi.muni.cz>

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2023-11-29 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 13:13 [PATCH] wfix: sigaltstack(2) example: function pointer Jan Kasprzak
2023-11-29 13:32 ` Alejandro Colomar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWc9X9lLr728N26x@debian \
    --to=alx@kernel.org \
    --cc=kas@fi.muni.cz \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).