diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-10-31 12:05:35 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-10-31 12:05:35 +0100 |
commit | 48801bec1ef80a97c14ec2c9974300a3e2a7eb21 (patch) | |
tree | a184a68119a75ee98ddc9ae161fb69538ec07d25 /src | |
parent | 92b848f05c63ce52cab1416e8b063cccbe341bb1 (diff) |
Work on using pledge() in OpenBSD
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -54,8 +54,20 @@ int main(int argc, char **argv) { mlib_setprogname(argv[0]); - setlocale(LC_ALL, ""); + /* TODO: Can we test this in an OpenBSD VM? */ +#if 0 && defined(__OpenBSD__) + const char *promises = +#if GIT_GRAB + "stdio rpath prot exec"; +#else + "stdio rpath"; +#endif + if (pledge("stdio rpath", NULL) == -1) + cerr(EXIT_FATAL, "pledge:"); +#endif + + setlocale(LC_ALL, ""); if (streq(nl_langinfo(CODESET), "UTF-8")) { lquot = u8"‘"; rquot = u8"’"; @@ -367,6 +379,11 @@ getfstream(int globc, char **globv) cerr(EXIT_FATAL, "execvp: git grep -Ilz '':"); } + /* TODO: Can we test this in an OpenBSD VM? */ +#if 0 && defined(__OpenBSD__) + if (pledge("stdio rpath") == -1) + cerr(EXIT_FATAL, "pledge:"); +#endif close(fds[W]); return fdopen(fds[R], "r"); } |