--- /dev/null
+#include <err.h>
+#include <errno.h>
+#include <sysexits.h>
+
+#include <capsicum_helpers.h>
+#include <sys/capsicum.h>
+
+static void
+capsicum_start(void)
+{
+ if (caph_limit_stdio() != 0) {
+ errx(EX_OSERR, "can not caph_limit_stdio()");
+ }
+ if (cap_enter() != 0) {
+ perror("Not using Capsicum");
+ if (errno != ENOSYS) {
+ exit(EXIT_FAILURE);
+ }
+ }
+}
#include <zstd.h>
+#ifdef __FreeBSD__
+#include "capsicum.c.in"
+#endif // __FreeBSD__
+
int
main(int argc, char **argv)
{
+#ifdef __FreeBSD__
+ capsicum_start();
+#endif // __FreeBSD__
ZSTD_CCtx *ctx = ZSTD_createCCtx();
if (ctx == NULL) {
fputs("can not initialize ZSTD_createCCtx\n", stderr);
#include <zstd.h>
+#ifdef __FreeBSD__
+#include "capsicum.c.in"
+#include <capsicum_helpers.h>
+#include <err.h>
+#include <sysexits.h>
+#endif // __FreeBSD__
+
int
main(int argc, char **argv)
{
+ FILE *fdOff = fdopen(3, "wb");
+#ifdef __FreeBSD__
+ if ((fdOff != NULL) && (caph_limit_stream(3, CAPH_WRITE)) != 0) {
+ errx(EX_OSERR, "can not caph_limit_stream(3)");
+ };
+ capsicum_start();
+#endif // __FreeBSD__
+
ZSTD_DCtx *ctx = ZSTD_createDCtx();
if (ctx == NULL) {
fputs("can not initialize ZSTD_DCtx\n", stderr);
return 1;
};
- FILE *fdOff = fdopen(3, "wb");
int rc = EXIT_FAILURE;
uint8_t *bufIn = NULL;
uint8_t *bufOut = NULL;