diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-08 01:52:38 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-08 01:52:38 +0000 |
commit | 4266a340480e27258cc6575570db59331a2beaa4 (patch) | |
tree | f75c09bae5fe03a119b97642bc748365c73beedf /usr.bin/tmux/server.c | |
parent | 789918712d759a9eee8cd38df93a8cb57ab9e736 (diff) |
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/server.c')
-rw-r--r-- | usr.bin/tmux/server.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 2d71a474087..0b211388b8a 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.99 2011/01/01 01:12:09 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.100 2011/01/08 01:52:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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(); |