OpenBSD: pledge final promises earlier
No need to wait for so long. This also brings all the pledge code on one screen and helps show how ircConnect() is the only relevant part in between initial and final promises.master
parent
1ccadd7c72
commit
3e0b38e48e
12
chat.c
12
chat.c
|
@ -315,6 +315,12 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
int irc = ircConnect(bind, host, port);
|
int irc = ircConnect(bind, host, port);
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
error = pledge(promisesFinal, NULL);
|
||||||
|
if (error) err(EX_OSERR, "pledge");
|
||||||
|
free(promisesFinal);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pass) ircFormat("PASS :%s\r\n", pass);
|
if (pass) ircFormat("PASS :%s\r\n", pass);
|
||||||
if (sasl) ircFormat("CAP REQ :sasl\r\n");
|
if (sasl) ircFormat("CAP REQ :sasl\r\n");
|
||||||
ircFormat("CAP LS\r\n");
|
ircFormat("CAP LS\r\n");
|
||||||
|
@ -343,12 +349,6 @@ int main(int argc, char *argv[]) {
|
||||||
fcntl(execPipe[1], F_SETFD, FD_CLOEXEC);
|
fcntl(execPipe[1], F_SETFD, FD_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
|
||||||
error = pledge(promisesFinal, NULL);
|
|
||||||
if (error) err(EX_OSERR, "pledge");
|
|
||||||
free(promisesFinal);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct pollfd fds[] = {
|
struct pollfd fds[] = {
|
||||||
{ .events = POLLIN, .fd = STDIN_FILENO },
|
{ .events = POLLIN, .fd = STDIN_FILENO },
|
||||||
{ .events = POLLIN, .fd = irc },
|
{ .events = POLLIN, .fd = irc },
|
||||||
|
|
Loading…
Reference in New Issue