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>
@ -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 */
}

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>
@ -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 */
}

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>
@ -155,6 +155,7 @@ server_client_lost(struct client *c)
c->flags |= CLIENT_DEAD;
recalculate_sizes();
server_update_socket();
}
/* 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>
@ -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. */

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>
@ -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);