mirror of https://github.com/mkerrisk/man-pages
sigaction.2: Minor tweaks to the code example
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
1875f17753
commit
ef0350ce4c
|
@ -1161,9 +1161,9 @@ handler(int signo, siginfo_t *info, void *context)
|
||||||
{
|
{
|
||||||
struct sigaction oldact;
|
struct sigaction oldact;
|
||||||
|
|
||||||
if (sigaction(SIGSEGV, NULL, &oldact) != 0 ||
|
if (sigaction(SIGSEGV, NULL, &oldact) == \-1 ||
|
||||||
(oldact.sa_flags & SA_UNSUPPORTED) ||
|
(oldact.sa_flags & SA_UNSUPPORTED) ||
|
||||||
!(oldact.sa_flags & SA_EXPOSE_TAGBITS)) {
|
!(oldact.sa_flags & SA_EXPOSE_TAGBITS)) {
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
|
@ -1172,11 +1172,11 @@ handler(int signo, siginfo_t *info, void *context)
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
struct sigaction act = {0};
|
struct sigaction act = { 0 };
|
||||||
|
|
||||||
act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS;
|
act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS;
|
||||||
act.sa_sigaction = &handler;
|
act.sa_sigaction = &handler;
|
||||||
if (sigaction(SIGSEGV, &act, NULL) != 0) {
|
if (sigaction(SIGSEGV, &act, NULL) == \-1) {
|
||||||
perror("sigaction");
|
perror("sigaction");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue