From 5bfba6df528d2d57daac93708b0dca6360711a80 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 29 Jun 2021 00:03:00 +0000 Subject: OpenBSD: merge unveil and pledge logic a bit This reads somewhat clearer as code is grouped by features instead of security mechanisms by simply merging identical tests/conditions. No functional change. --- chat.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/chat.c b/chat.c index 0bdb69c..ab0678a 100644 --- a/chat.c +++ b/chat.c @@ -282,24 +282,23 @@ int main(int argc, char *argv[]) { } #ifdef __OpenBSD__ + char promises[64] = "stdio tty"; + char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)]; + if (log) { const char *logdir = dataMkdir("log"); int error = unveil(logdir, "wc"); if (error) err(EX_OSERR, "unveil"); + ptr = seprintf(ptr, end, " wpath cpath"); } if (!self.restricted) { int error = unveil("/", "x"); if (error) err(EX_OSERR, "unveil"); + ptr = seprintf(ptr, end, " proc exec"); } - char promises[64] = "stdio tty"; - char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)]; - if (log) ptr = seprintf(ptr, end, " wpath cpath"); - if (!self.restricted) ptr = seprintf(ptr, end, " proc exec"); - char *promisesInitial = ptr; - ptr = seprintf(ptr, end, " inet dns"); int error = pledge(promises, NULL); if (error) err(EX_OSERR, "pledge"); -- cgit 1.4.1 lass='form'>
path: root/bin/cash/alias.h (unfollow)
Commit message (Expand)Author
2019-02-09Fix IRC output monospace option to emit once per lineJune McEnroe
2019-02-09Add output format options to hiJune McEnroe
2019-02-09Avoid using SGRReset and IRCResetJune McEnroe
2019-02-08Use X macros for hi classesJune McEnroe
2019-02-08Don't open folds when using {}June McEnroe
2019-02-08Add sh syntax to hiJune McEnroe
2019-02-08Use [] to quote special characters in regexJune McEnroe
2019-02-08Improve ANSI output and base IRC on itJune McEnroe
2019-02-08Add hi -nJune McEnroe
2019-02-08Elaborate hi man pageJune McEnroe
2019-02-08Use set for parent in hiJune McEnroe
2019-02-08Switch back to semantic keyword grouping in hiJune McEnroe
2019-02-08Match only the basename in hiJune McEnroe
2019-02-07Add mdoc syntax to hiJune McEnroe
2019-02-07Support multi-line C macros in hiJune McEnroe
2019-02-07Detect .mk files as makeJune McEnroe
2019-02-07Add make syntax to hiJune McEnroe
2019-02-07Add IRC output to hiJune McEnroe
2019-02-07Improve C syntax accuracy and add Format classJune McEnroe
2019-02-07Factor out hi checkJune McEnroe
2019-02-07Add Escape class to hiJune McEnroe
2019-02-07Add Todo class and parent syntax constraintJune McEnroe