* [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* Re: [PATCH] wfix: sigaltstack(2) example: function pointer
2023-11-29 13:13 [PATCH] wfix: sigaltstack(2) example: function pointer Jan Kasprzak
@ 2023-11-29 13:32 ` Alejandro Colomar
0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2023-11-29 13:32 UTC (permalink / raw)
To: Jan Kasprzak; +Cc: linux-man
[-- 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 --]
^ permalink raw reply [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