Move setting CLOEXEC on socket to ircConnect
parent
16b34e5cd2
commit
a0cc519829
1
chat.c
1
chat.c
|
@ -338,7 +338,6 @@ int main(int argc, char *argv[]) {
|
||||||
signal(SIGTERM, signalHandler);
|
signal(SIGTERM, signalHandler);
|
||||||
signal(SIGCHLD, signalHandler);
|
signal(SIGCHLD, signalHandler);
|
||||||
|
|
||||||
fcntl(irc, F_SETFD, FD_CLOEXEC);
|
|
||||||
bool pipes = !self.kiosk && !self.restricted;
|
bool pipes = !self.kiosk && !self.restricted;
|
||||||
if (pipes) {
|
if (pipes) {
|
||||||
int error = pipe(utilPipe) || pipe(execPipe);
|
int error = pipe(utilPipe) || pipe(execPipe);
|
||||||
|
|
2
irc.c
2
irc.c
|
@ -28,6 +28,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -157,6 +158,7 @@ int ircConnect(const char *bindHost, const char *host, const char *port) {
|
||||||
if (sock < 0) err(EX_UNAVAILABLE, "%s:%s", host, port);
|
if (sock < 0) err(EX_UNAVAILABLE, "%s:%s", host, port);
|
||||||
freeaddrinfo(head);
|
freeaddrinfo(head);
|
||||||
|
|
||||||
|
fcntl(sock, F_SETFD, FD_CLOEXEC);
|
||||||
error = tls_connect_socket(client, sock, host);
|
error = tls_connect_socket(client, sock, host);
|
||||||
if (error) errx(EX_PROTOCOL, "tls_connect: %s", tls_error(client));
|
if (error) errx(EX_PROTOCOL, "tls_connect: %s", tls_error(client));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue