logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit ac82118befb29da577a71056fc315f7b9b53ae80
parent 6c8d066ba119afc9485ad05da88059bba5c4ab64
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 28 Oct 2019 15:53:20 +0100

Add error checking for both prctl() calls.

Diffstat:
Msrc/logswan.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -4,7 +4,7 @@ * https://www.logswan.org * * Created: 2015-05-31 - * Last Updated: 2019-10-25 + * Last Updated: 2019-10-28 * * Logswan is released under the BSD 2-Clause license. * See LICENSE file for details. @@ -102,8 +102,15 @@ main(int argc, char *argv[]) { } #ifdef HAVE_SECCOMP - prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); - prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &logswan); + 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, &logswan)) { + perror("Can't load seccomp filter"); + return EXIT_FAILURE; + } #endif hll_init(&uniqueIPv4, HLL_BITS);