sigaltstack.2: Add explicit error handling to example code

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-10-30 10:01:12 +01:00
parent 55f780fe47
commit 93c33be846
1 changed files with 8 additions and 3 deletions

View File

@ -295,12 +295,17 @@ The following code segment demonstrates the use of
stack_t ss;
ss.ss_sp = malloc(SIGSTKSZ);
if (ss.ss_sp == NULL)
/* Handle error */;
if (ss.ss_sp == NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == \-1)
/* Handle error */;
perror("sigaltstack");
exit(EXIT_FAILURE);
}
.EE
.in
.SH BUGS