mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Pass a set of flags into client_init rather than just a start_server
variable. Only one flag now but more to come later.
This commit is contained in:
		
							
								
								
									
										6
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								client.c
									
									
									
									
									
								
							@@ -36,7 +36,7 @@
 | 
			
		||||
void	client_handle_winch(struct client_ctx *);
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
client_init(char *path, struct client_ctx *cctx, int start_server, int flags)
 | 
			
		||||
client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags)
 | 
			
		||||
{
 | 
			
		||||
	struct sockaddr_un		sa;
 | 
			
		||||
	struct stat			sb;
 | 
			
		||||
@@ -53,7 +53,7 @@ client_init(char *path, struct client_ctx *cctx, int start_server, int flags)
 | 
			
		||||
	setproctitle("client (%s)", rpathbuf);
 | 
			
		||||
 | 
			
		||||
	if (lstat(path, &sb) != 0) {
 | 
			
		||||
		if (start_server && errno == ENOENT) {
 | 
			
		||||
		if (cmdflags & CMD_STARTSERVER && errno == ENOENT) {
 | 
			
		||||
			if ((cctx->srv_fd = server_start(path)) == -1)
 | 
			
		||||
				goto start_failed;
 | 
			
		||||
			goto server_started;
 | 
			
		||||
@@ -79,7 +79,7 @@ client_init(char *path, struct client_ctx *cctx, int start_server, int flags)
 | 
			
		||||
	if (connect(
 | 
			
		||||
	    cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) {
 | 
			
		||||
		if (errno == ECONNREFUSED) {
 | 
			
		||||
			if (unlink(path) != 0 || !start_server)
 | 
			
		||||
			if (unlink(path) != 0 || !(cmdflags & CMD_STARTSERVER))
 | 
			
		||||
				goto not_found;
 | 
			
		||||
			if ((cctx->srv_fd = server_start(path)) == -1)
 | 
			
		||||
				goto start_failed;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user