summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-13 16:51:49 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-13 16:51:49 +0000
commit1b4a76d58fc513b53ec86c8226621c012de62e5f (patch)
tree0e95d76349790a3da9a54049ce57c4b43a4f7231
parent7230fe1648831a17165201b6f02e0365f7b5f938 (diff)
Sync OpenBSD patchset 527:
Only need to chmod +x or -x the socket when a client is created, lost or attached, rather than every event loop.
-rw-r--r--cmd-attach-session.c3
-rw-r--r--cmd-new-session.c3
-rw-r--r--server-client.c3
-rw-r--r--server.c11
-rw-r--r--tmux.h3
5 files changed, 12 insertions, 11 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index d83e4c58..dc5f6abf 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.32 2009-08-09 17:48:55 tcunha Exp $ */
+/* $Id: cmd-attach-session.c,v 1.33 2009-11-13 16:51:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -101,6 +101,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_client(ctx->cmdclient);
}
recalculate_sizes();
+ server_update_socket();
return (1); /* 1 means don't tell command client to exit */
}
diff --git a/cmd-new-session.c b/cmd-new-session.c
index d481fdab..e31f614d 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.69 2009-10-12 00:49:06 tcunha Exp $ */
+/* $Id: cmd-new-session.c,v 1.70 2009-11-13 16:51:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -277,6 +277,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
}
}
recalculate_sizes();
+ server_update_socket();
return (!detached); /* 1 means don't tell command client to exit */
}
diff --git a/server-client.c b/server-client.c
index 8a4514ac..cc3f8312 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.19 2009-11-08 23:26:56 tcunha Exp $ */
+/* $Id: server-client.c,v 1.20 2009-11-13 16:51:49 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -155,6 +155,7 @@ server_client_lost(struct client *c)
c->flags |= CLIENT_DEAD;
recalculate_sizes();
+ server_update_socket();
}
/* Process a single client event. */
diff --git a/server.c b/server.c
index f67b3667..0637a2a3 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.226 2009-11-11 09:54:07 nicm Exp $ */
+/* $Id: server.c,v 1.227 2009-11-13 16:51:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -58,7 +58,6 @@ void server_loop(void);
int server_should_shutdown(void);
void server_send_shutdown(void);
void server_clean_dead(void);
-int server_update_socket(void);
void server_accept_callback(int, short, void *);
void server_signal_callback(int, short, void *);
void server_child_signal(void);
@@ -104,6 +103,8 @@ server_create_socket(void)
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed");
+ server_update_socket();
+
return (fd);
}
@@ -226,8 +227,6 @@ void
server_loop(void)
{
while (!server_should_shutdown()) {
- server_update_socket();
-
event_loop(EVLOOP_ONCE);
server_window_loop();
@@ -306,7 +305,7 @@ server_clean_dead(void)
}
/* Update socket execute permissions based on whether sessions are attached. */
-int
+void
server_update_socket(void)
{
struct session *s;
@@ -330,8 +329,6 @@ server_update_socket(void)
else
chmod(socket_path, S_IRUSR|S_IWUSR);
}
-
- return (n);
}
/* Callback for server socket. */
diff --git a/tmux.h b/tmux.h
index fa8b1b71..4d68bd2d 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.512 2009-11-10 23:31:21 tcunha Exp $ */
+/* $Id: tmux.h,v 1.513 2009-11-13 16:51:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1556,6 +1556,7 @@ extern struct clients dead_clients;
int server_start(char *);
void server_signal_set(void);
void server_signal_clear(void);
+void server_update_socket(void);
/* server-client.c */
void server_client_create(int);