diff options
author | 2011-01-08 01:52:36 +0000 | |
---|---|---|
committer | 2011-01-08 01:52:36 +0000 | |
commit | a0ee42549e7fbfd1cf31458e1926b09c07492922 (patch) | |
tree | ce276070f9ff977a91ddacaa8e83f2276ed2d437 /usr.bin/tmux/client.c | |
parent | destatic. ok deraadt (diff) | |
download | wireguard-openbsd-a0ee42549e7fbfd1cf31458e1926b09c07492922.tar.xz wireguard-openbsd-a0ee42549e7fbfd1cf31458e1926b09c07492922.zip |
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").
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r-- | usr.bin/tmux/client.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index b3e0dcab8a5..65efc40550b 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.46 2010/10/18 20:00:02 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.47 2011/01/08 01:52:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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: |