Clean up if restricted && logEnable, pipe creation

master
C. McEnroe 2021-06-17 18:26:09 -04:00
parent 188fc678bd
commit a8c1f02976
1 changed files with 4 additions and 9 deletions

9
chat.c
View File

@ -284,12 +284,10 @@ int main(int argc, char *argv[]) {
}
#ifdef __OpenBSD__
if (self.restricted) {
if (logEnable) {
if (self.restricted && logEnable) {
dataMkdir("");
unveilData("");
}
}
char promises[64] = "stdio tty";
char *ptr = &promises[strlen(promises)], *end = &promises[sizeof(promises)];
@ -338,10 +336,7 @@ int main(int argc, char *argv[]) {
fcntl(irc, F_SETFD, FD_CLOEXEC);
bool pipes = !self.kiosk && !self.restricted;
if (pipes) {
int error = pipe(utilPipe);
if (error) err(EX_OSERR, "pipe");
error = pipe(execPipe);
int error = pipe(utilPipe) || pipe(execPipe);
if (error) err(EX_OSERR, "pipe");
fcntl(utilPipe[0], F_SETFD, FD_CLOEXEC);