From 69cb1f830e4fd2282ddcbc7ee2bbe30069b9e4cd Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 8 Jan 2011 01:52:36 +0000 Subject: 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"). --- client.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 35a2e4e8..1ff3e1f1 100644 --- a/client.c +++ b/client.c @@ -54,7 +54,7 @@ client_connect(char *path, int start_server) { struct sockaddr_un sa; size_t size; - int fd, mode; + int fd; memset(&sa, 0, sizeof sa); sa.sun_family = AF_UNIX; @@ -84,10 +84,7 @@ client_connect(char *path, int start_server) } } - 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); return (fd); failed: -- cgit