mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Initialise log_fd to -1, prevents spurious disconnection of the client when it
ends up as fd 0 (likely if the server is started with "tmux start"). Also add some extra debugging messages to server.c.
This commit is contained in:
		
							
								
								
									
										3
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								server.c
									
									
									
									
									
								
							| @@ -110,6 +110,7 @@ server_create_client(int fd) | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	ARRAY_ADD(&clients, c); | 	ARRAY_ADD(&clients, c); | ||||||
|  | 	log_debug("new client %d", fd); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Find client index. */ | /* Find client index. */ | ||||||
| @@ -257,6 +258,7 @@ server_main(int srv_fd) | |||||||
| 	time_t		 now, last; | 	time_t		 now, last; | ||||||
|  |  | ||||||
| 	siginit(); | 	siginit(); | ||||||
|  | 	log_debug("server socket is %d", srv_fd); | ||||||
|  |  | ||||||
| 	last = time(NULL); | 	last = time(NULL); | ||||||
|  |  | ||||||
| @@ -901,6 +903,7 @@ server_lost_client(struct client *c) | |||||||
| 		if (ARRAY_ITEM(&clients, i) == c) | 		if (ARRAY_ITEM(&clients, i) == c) | ||||||
| 			ARRAY_SET(&clients, i, NULL); | 			ARRAY_SET(&clients, i, NULL); | ||||||
| 	} | 	} | ||||||
|  | 	log_debug("lost client %d", c->ibuf.fd); | ||||||
|  |  | ||||||
| 	tty_free(&c->tty); | 	tty_free(&c->tty); | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tty.c
									
									
									
									
									
								
							| @@ -49,6 +49,7 @@ tty_init(struct tty *tty, int fd, char *path, char *term) | |||||||
| { | { | ||||||
| 	tty->path = xstrdup(path); | 	tty->path = xstrdup(path); | ||||||
| 	tty->fd = fd; | 	tty->fd = fd; | ||||||
|  | 	tty->log_fd = -1; | ||||||
|  |  | ||||||
| 	if (term == NULL || *term == '\0') | 	if (term == NULL || *term == '\0') | ||||||
| 		tty->termname = xstrdup("unknown"); | 		tty->termname = xstrdup("unknown"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nicholas Marriott
					Nicholas Marriott