From b1a8c244cedc4713dcec3d2cc144ac60887e8420 Mon Sep 17 00:00:00 2001 From: codesoap Date: Sat, 22 Apr 2023 22:59:46 +0200 Subject: [PATCH] main: add pledge call on OpenBSD --- examples/main/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index b7b3c4196..5f51a24b6 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -43,6 +43,13 @@ void sigint_handler(int signo) { #endif int main(int argc, char ** argv) { +#if defined (__OpenBSD__) + if (pledge("stdio rpath", "") == -1) { + fprintf(stderr, "%s: error: pledge failed\n", __func__); + return 1; + } +#endif + gpt_params params; params.model = "models/llama-7B/ggml-model.bin";