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.
This commit is contained in:
Tiago Cunha 2009-11-13 16:51:49 +00:00
parent 7230fe1648
commit 1b4a76d58f
5 changed files with 12 additions and 11 deletions

View File

@ -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> * 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); server_redraw_client(ctx->cmdclient);
} }
recalculate_sizes(); recalculate_sizes();
server_update_socket();
return (1); /* 1 means don't tell command client to exit */ return (1); /* 1 means don't tell command client to exit */
} }

View File

@ -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> * 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(); recalculate_sizes();
server_update_socket();
return (!detached); /* 1 means don't tell command client to exit */ return (!detached); /* 1 means don't tell command client to exit */
} }

View File

@ -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> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -155,6 +155,7 @@ server_client_lost(struct client *c)
c->flags |= CLIENT_DEAD; c->flags |= CLIENT_DEAD;
recalculate_sizes(); recalculate_sizes();
server_update_socket();
} }
/* Process a single client event. */ /* Process a single client event. */

View File

@ -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> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -58,7 +58,6 @@ void server_loop(void);
int server_should_shutdown(void); int server_should_shutdown(void);
void server_send_shutdown(void); void server_send_shutdown(void);
void server_clean_dead(void); void server_clean_dead(void);
int server_update_socket(void);
void server_accept_callback(int, short, void *); void server_accept_callback(int, short, void *);
void server_signal_callback(int, short, void *); void server_signal_callback(int, short, void *);
void server_child_signal(void); void server_child_signal(void);
@ -104,6 +103,8 @@ server_create_socket(void)
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
fatal("fcntl failed"); fatal("fcntl failed");
server_update_socket();
return (fd); return (fd);
} }
@ -226,8 +227,6 @@ void
server_loop(void) server_loop(void)
{ {
while (!server_should_shutdown()) { while (!server_should_shutdown()) {
server_update_socket();
event_loop(EVLOOP_ONCE); event_loop(EVLOOP_ONCE);
server_window_loop(); server_window_loop();
@ -306,7 +305,7 @@ server_clean_dead(void)
} }
/* Update socket execute permissions based on whether sessions are attached. */ /* Update socket execute permissions based on whether sessions are attached. */
int void
server_update_socket(void) server_update_socket(void)
{ {
struct session *s; struct session *s;
@ -330,8 +329,6 @@ server_update_socket(void)
else else
chmod(socket_path, S_IRUSR|S_IWUSR); chmod(socket_path, S_IRUSR|S_IWUSR);
} }
return (n);
} }
/* Callback for server socket. */ /* Callback for server socket. */

3
tmux.h
View File

@ -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> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1556,6 +1556,7 @@ extern struct clients dead_clients;
int server_start(char *); int server_start(char *);
void server_signal_set(void); void server_signal_set(void);
void server_signal_clear(void); void server_signal_clear(void);
void server_update_socket(void);
/* server-client.c */ /* server-client.c */
void server_client_create(int); void server_client_create(int);