mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things like "tmux ls && cat").
This commit is contained in:
8
server.c
8
server.c
@ -74,7 +74,7 @@ server_create_socket(void)
|
||||
struct sockaddr_un sa;
|
||||
size_t size;
|
||||
mode_t mask;
|
||||
int fd, mode;
|
||||
int fd;
|
||||
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sun_family = AF_UNIX;
|
||||
@ -95,11 +95,7 @@ server_create_socket(void)
|
||||
|
||||
if (listen(fd, 16) == -1)
|
||||
fatal("listen failed");
|
||||
|
||||
if ((mode = fcntl(fd, F_GETFL)) == -1)
|
||||
fatal("fcntl failed");
|
||||
if (fcntl(fd, F_SETFL, mode|O_NONBLOCK) == -1)
|
||||
fatal("fcntl failed");
|
||||
setblocking(fd, 0);
|
||||
|
||||
server_update_socket();
|
||||
|
||||
|
Reference in New Issue
Block a user