mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00: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