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

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.
(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>
---
 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

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

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

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=20231129131359.GH18109@fi.muni.cz \
    --to=kas@fi.muni.cz \
    --cc=alx@kernel.org \
    --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).