diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-10-30 10:01:12 +0100 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2017-11-08 08:36:50 +0100 |
| commit | 93c33be846873f3be30a7f2afda90dfd9067ba07 (patch) | |
| tree | 44110e2cc2bca11fe90654f518ce47ed8e9a8a85 /man2/sigaltstack.2 | |
| parent | 55f780fe47e56c2da45546a398e96a3de96bb0f5 (diff) | |
| download | man-pages-93c33be846873f3be30a7f2afda90dfd9067ba07.tar.gz | |
sigaltstack.2: Add explicit error handling to example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man2/sigaltstack.2')
| -rw-r--r-- | man2/sigaltstack.2 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/man2/sigaltstack.2 b/man2/sigaltstack.2 index f1506cfba0..189db1b3ae 100644 --- a/man2/sigaltstack.2 +++ b/man2/sigaltstack.2 @@ -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 |
