ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit 4521577c12b49788ce580ad0e4a41f118211951d
parent 449db5ba63cc63ef26f07ef89f50b047f632e691
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 28 Oct 2019 17:08:39 +0100

Add error checking for both prctl() calls.

Diffstat:
Msrc/ansilove.c | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ansilove.c b/src/ansilove.c @@ -86,8 +86,15 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "pledge"); #ifdef HAVE_SECCOMP - prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); - prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &ansilove); + if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { + perror("Can't initialize seccomp"); + return EXIT_FAILURE; + } + + if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &ansilove)) { + perror("Can't load seccomp filter"); + return EXIT_FAILURE; + } #endif if (ansilove_init(&ctx, &options) == -1)