summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-01-21 23:44:13 +0000
committerTiago Cunha <tcunha@gmx.com>2011-01-21 23:44:13 +0000
commit492e3aa4373f0f20a8685cfb3591a9730bb0454a (patch)
tree3f11c4b5b3b68706442324e1be636c07e25d3db5 /server.c
parent6b19621112c2fccdcde88f864291ef0939820b0d (diff)
Sync OpenBSD patchset 834:
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 'server.c')
-rw-r--r--server.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/server.c b/server.c
index 6095bdd3..8514fbb7 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.251 2011-01-03 23:27:54 tcunha Exp $ */
+/* $Id: server.c,v 1.252 2011-01-21 23:44:13 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -73,7 +73,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;
@@ -94,11 +94,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();