Move unveilAll back into main

It doesn't do as much anymore, so move it back inline.
weechat-hashes
C. McEnroe 2021-06-10 15:40:45 -04:00
parent 0b4004c202
commit 275d657b8b
1 changed files with 8 additions and 12 deletions

20
chat.c
View File

@ -127,7 +127,6 @@ static void parseHash(char *str) {
} }
#ifdef __OpenBSD__ #ifdef __OpenBSD__
static void unveilData(const char *name) { static void unveilData(const char *name) {
const char *dirs = NULL; const char *dirs = NULL;
for (const char *path; NULL != (path = dataPath(&dirs, name));) { for (const char *path; NULL != (path = dataPath(&dirs, name));) {
@ -135,16 +134,7 @@ static void unveilData(const char *name) {
if (error && errno != ENOENT) err(EX_CANTCREAT, "%s", path); if (error && errno != ENOENT) err(EX_CANTCREAT, "%s", path);
} }
} }
#endif
static void unveilAll(void) {
if (save || logEnable) {
dataMkdir("");
unveilData("");
}
if (save) unveilData(save);
}
#endif /* __OpenBSD__ */
static volatile sig_atomic_t signals[NSIG]; static volatile sig_atomic_t signals[NSIG];
static void signalHandler(int signal) { static void signalHandler(int signal) {
@ -288,7 +278,13 @@ int main(int argc, char *argv[]) {
uiInitEarly(); uiInitEarly();
#ifdef __OpenBSD__ #ifdef __OpenBSD__
if (self.restricted) unveilAll(); if (self.restricted) {
if (save || logEnable) {
dataMkdir("");
unveilData("");
}
if (save) unveilData(save);
}
char promises[64] = "stdio tty"; char promises[64] = "stdio tty";
char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)]; char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)];