diff options
author | Klemens Nanni | 2021-06-11 12:30:59 +0000 |
---|---|---|
committer | C. McEnroe | 2021-06-11 20:57:40 -0400 |
commit | 772c9789b785231e235e08af69da89273027cf70 (patch) | |
tree | 57ac8bdda7b686e698d5e6a481368a0add7a3356 | |
parent | cdd4ccf16ff6ccc202d3422fcd0ec7ca9f3a8229 (diff) |
OpenBSD: Drop now unneeded file system access for save file
All opening happens before unveil/pledge and the file handle is kept open read/write so it can be used without any pledge. Simpler/less code and less chances to write other files (accidentially).
-rw-r--r-- | chat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/chat.c b/chat.c index e6cd270..d92240d 100644 --- a/chat.c +++ b/chat.c @@ -283,16 +283,15 @@ int main(int argc, char *argv[]) { #ifdef __OpenBSD__ if (self.restricted) { - if (save || logEnable) { + if (logEnable) { dataMkdir(""); unveilData(""); } - if (save) unveilData(save); } char promises[64] = "stdio tty"; char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)]; - if (save || logEnable) ptr = seprintf(ptr, end, " wpath cpath"); + if (logEnable) ptr = seprintf(ptr, end, " wpath cpath"); if (!self.restricted) ptr = seprintf(ptr, end, " proc exec"); char *promisesFinal = strdup(promises); |