mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 20:58:53 +00:00
Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
This commit is contained in:
parent
15b9946a40
commit
2756437f4b
@ -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 */
|
||||
}
|
||||
|
@ -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 */
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ server_client_lost(struct client *c)
|
||||
c->flags |= CLIENT_DEAD;
|
||||
|
||||
recalculate_sizes();
|
||||
server_update_socket();
|
||||
}
|
||||
|
||||
/* Process a single client event. */
|
||||
|
9
server.c
9
server.c
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user