mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Use symbolic name for FD_CLOEXEC
Unsure why I was using ‘1’ — perhaps the symbolic name was missing in the older SDK.
This commit is contained in:
@@ -136,7 +136,7 @@ namespace
|
||||
}
|
||||
|
||||
socket_t fd(socket(AF_UNIX, SOCK_STREAM, 0));
|
||||
fcntl(fd, F_SETFD, 1);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
struct sockaddr_un addr = { 0, AF_UNIX };
|
||||
strcpy(addr.sun_path, _socket_path);
|
||||
addr.sun_len = SUN_LEN(&addr);
|
||||
@@ -169,7 +169,7 @@ namespace
|
||||
socket_t fd(socket(AF_INET, SOCK_STREAM, 0));
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
|
||||
fcntl(fd, F_SETFD, 1);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
struct sockaddr_in iaddr = { sizeof(sockaddr_in), AF_INET, htons(_port), { htonl(_ip) } };
|
||||
if(-1 == bind(fd, (sockaddr*)&iaddr, sizeof(iaddr)))
|
||||
fprintf(stderr, "bind(): %s\n", strerror(errno));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace
|
||||
{
|
||||
client_key = server().register_client(this);
|
||||
int newFd = dup(fd);
|
||||
fcntl(newFd, F_SETFD, 1);
|
||||
fcntl(newFd, F_SETFD, FD_CLOEXEC);
|
||||
server().send_request(client_key, (request_t){ newFd, str });
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace filter
|
||||
{
|
||||
_client_key = write_server().register_client(this);
|
||||
int newFd = dup(fd);
|
||||
fcntl(newFd, F_SETFD, 1);
|
||||
fcntl(newFd, F_SETFD, FD_CLOEXEC);
|
||||
write_server().send_request(_client_key, (request_t){ newFd, bytes });
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace io
|
||||
write_pipe = pipes[1];
|
||||
if(close_on_exec)
|
||||
{
|
||||
fcntl(pipes[0], F_SETFD, 1);
|
||||
fcntl(pipes[1], F_SETFD, 1);
|
||||
fcntl(pipes[0], F_SETFD, FD_CLOEXEC);
|
||||
fcntl(pipes[1], F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ private:
|
||||
{
|
||||
WATCH_LEAKS(helper_t);
|
||||
|
||||
helper_t (int fd) : fd(fd) { if(fd != -1) fcntl(fd, F_SETFD, 1); }
|
||||
helper_t (int fd) : fd(fd) { if(fd != -1) fcntl(fd, F_SETFD, FD_CLOEXEC); }
|
||||
~helper_t () { if(fd != -1) close(fd); }
|
||||
int fd;
|
||||
};
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace network
|
||||
{
|
||||
close(input[0]);
|
||||
close(output[1]);
|
||||
fcntl(input[1], F_SETFD, 1);
|
||||
fcntl(output[0], F_SETFD, 1);
|
||||
fcntl(input[1], F_SETFD, FD_CLOEXEC);
|
||||
fcntl(output[0], F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace network
|
||||
}
|
||||
else
|
||||
{
|
||||
fcntl(input = in[1], F_SETFD, 1);
|
||||
fcntl(output = out[0], F_SETFD, 1);
|
||||
fcntl(input = in[1], F_SETFD, FD_CLOEXEC);
|
||||
fcntl(output = out[0], F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
}
|
||||
return pid;
|
||||
|
||||
Reference in New Issue
Block a user