summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-11-11 08:00:43 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-11-11 08:00:43 +0000
commite9562d24870837453ece1ae7898fdf93f9ac66ab (patch)
treea27c3c61a02d4b0715e2da831b961ba3ab2febeb
parentbfb0f4fec84a72e97be1b73db2c40202e07808b6 (diff)
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--usr.bin/tmux/cmd-attach-session.c3
-rw-r--r--usr.bin/tmux/cmd-new-session.c3
-rw-r--r--usr.bin/tmux/server-client.c3
-rw-r--r--usr.bin/tmux/server.c11
-rw-r--r--usr.bin/tmux/tmux.h3
5 files changed, 12 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index 9c867737d0d..310f7a1eb9e 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.8 2009/08/08 21:52:43 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.9 2009/11/11 08:00:42 nicm 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/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 38907bc6c45..7671ed5563a 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.21 2009/10/10 10:02:48 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.22 2009/11/11 08:00:42 nicm 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/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 0b3bc785e69..bd4b3ed61fc 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.18 2009/11/05 08:45:08 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.19 2009/11/11 08:00:42 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -156,6 +156,7 @@ server_client_lost(struct client *c)
c->flags |= CLIENT_DEAD;
recalculate_sizes();
+ server_update_socket();
}
/* Process a single client event. */
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c
index 05515db4248..fbdb2f25754 100644
--- a/usr.bin/tmux/server.c
+++ b/usr.bin/tmux/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.74 2009/11/05 08:50:32 nicm Exp $ */
+/* $OpenBSD: server.c,v 1.75 2009/11/11 08:00:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -59,7 +59,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);
@@ -105,6 +104,8 @@ server_create_socket(void)
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed");
+ server_update_socket();
+
return (fd);
}
@@ -208,8 +209,6 @@ void
server_loop(void)
{
while (!server_should_shutdown()) {
- server_update_socket();
-
event_loop(EVLOOP_ONCE);
server_window_loop();
@@ -288,7 +287,7 @@ server_clean_dead(void)
}
/* Update socket execute permissions based on whether sessions are attached. */
-int
+void
server_update_socket(void)
{
struct session *s;
@@ -312,8 +311,6 @@ server_update_socket(void)
else
chmod(socket_path, S_IRUSR|S_IWUSR);
}
-
- return (n);
}
/* Callback for server socket. */
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 74398e8fbb3..cc566abf6c1 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.174 2009/11/10 17:41:35 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.175 2009/11/11 08:00:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1557,6 +1557,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);