mirror of https://github.com/mkerrisk/man-pages
sigaltstack.2: Add explicit error handling to example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
55f780fe47
commit
93c33be846
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue