wfix: sigaltstack(2) example: function pointer
PATCH 1/1 wfix: sigaltstack(2) example: function pointer
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 <[email protected]>
--- man2/sigaltstack.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/sigaltstack.2 +1 -1
@@ -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");
Signature · 8 lines
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 WallAlejandro Colomar
maintainerHi Jan,
Quoted 6 lines · Jan Kasprzak
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/
Quoted 4 lines
(Unless there is a function named "handler" returning a pointer to some _other_ function, of course).
Signed-off-by Jan "Yenya" Kasprzak <[email protected]>
Thanks,
Alex
Quoted 26 lines
--- man2/sigaltstack.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/sigaltstack.2 +1
-1@@ -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");Signature · 8 lines
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
Signature · 1 line
<https://www.alejandro-colomar.es/>