public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wfix: sigaltstack(2) example: function pointer
@ 2023-11-29 13:13 Jan Kasprzak
  2023-11-29 13:32 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kasprzak @ 2023-11-29 13:13 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-29 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-29 13:13 [PATCH] wfix: sigaltstack(2) example: function pointer Jan Kasprzak
2023-11-29 13:32 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox