mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-14 07:49:01 +02:00
Sync OpenBSD patchset 1043:
Use a lock file and flock() to serialize server start, avoids problems when running a bunch of tmux from cron at the same time. Based on a diff from Tim Ruehsen.
This commit is contained in:
6
server.c
6
server.c
@ -103,7 +103,7 @@ server_create_socket(void)
|
||||
|
||||
/* Fork new server. */
|
||||
int
|
||||
server_start(void)
|
||||
server_start(int lockfd, char *lockfile)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
int pair[2];
|
||||
@ -162,6 +162,10 @@ server_start(void)
|
||||
server_fd = server_create_socket();
|
||||
server_client_create(pair[1]);
|
||||
|
||||
unlink(lockfile);
|
||||
xfree(lockfile);
|
||||
close(lockfd);
|
||||
|
||||
if (access(SYSTEM_CFG, R_OK) == 0)
|
||||
load_cfg(SYSTEM_CFG, NULL, &cfg_causes);
|
||||
else if (errno != ENOENT) {
|
||||
|
Reference in New Issue
Block a user