mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Handle empty or unset TERM correctly; also fix a fatal() message while here.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $OpenBSD: server-msg.c,v 1.4 2009/07/07 12:34:47 nicm Exp $ */
 | 
					/* $OpenBSD: server-msg.c,v 1.5 2009/07/07 17:24:32 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -211,7 +211,9 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c)
 | 
				
			|||||||
		c->tty.term_flags |= TERM_88COLOURS;
 | 
							c->tty.term_flags |= TERM_88COLOURS;
 | 
				
			||||||
	if (data.flags & IDENTIFY_HASDEFAULTS)
 | 
						if (data.flags & IDENTIFY_HASDEFAULTS)
 | 
				
			||||||
		c->tty.term_flags |= TERM_HASDEFAULTS;
 | 
							c->tty.term_flags |= TERM_HASDEFAULTS;
 | 
				
			||||||
	xfree(term);
 | 
					
 | 
				
			||||||
 | 
						if (term != NULL)
 | 
				
			||||||
 | 
							xfree(term);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	c->flags |= CLIENT_TERMINAL;
 | 
						c->flags |= CLIENT_TERMINAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								tty.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: tty.c,v 1.110 2009-07-01 23:06:32 nicm Exp $ */
 | 
					/* $OpenBSD: tty.c,v 1.9 2009/07/07 17:24:32 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -76,7 +76,7 @@ void
 | 
				
			|||||||
tty_init(struct tty *tty, char *path, char *term)
 | 
					tty_init(struct tty *tty, char *path, char *term)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	tty->path = xstrdup(path);
 | 
						tty->path = xstrdup(path);
 | 
				
			||||||
	if (term == NULL)
 | 
						if (term == NULL || *term == '\0')
 | 
				
			||||||
		tty->termname = xstrdup("unknown");
 | 
							tty->termname = xstrdup("unknown");
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		tty->termname = xstrdup(term);
 | 
							tty->termname = xstrdup(term);
 | 
				
			||||||
@@ -98,7 +98,7 @@ tty_open(struct tty *tty, char **cause)
 | 
				
			|||||||
	if ((mode = fcntl(tty->fd, F_GETFL)) == -1)
 | 
						if ((mode = fcntl(tty->fd, F_GETFL)) == -1)
 | 
				
			||||||
		fatal("fcntl failed");
 | 
							fatal("fcntl failed");
 | 
				
			||||||
	if (fcntl(tty->fd, F_SETFL, mode|O_NONBLOCK) == -1)
 | 
						if (fcntl(tty->fd, F_SETFL, mode|O_NONBLOCK) == -1)
 | 
				
			||||||
		fatal("fcntl failedo");
 | 
							fatal("fcntl failed");
 | 
				
			||||||
	if (fcntl(tty->fd, F_SETFD, FD_CLOEXEC) == -1)
 | 
						if (fcntl(tty->fd, F_SETFD, FD_CLOEXEC) == -1)
 | 
				
			||||||
		fatal("fcntl failed");
 | 
							fatal("fcntl failed");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user