diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-07 17:24:33 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-07 17:24:33 +0000 |
commit | 540531a12acafaaf1a8bb16ed85a6f3487f89908 (patch) | |
tree | b19b98af115f39b1e3e3dd430562edaea590d97b /usr.bin | |
parent | c3089c5ec2b2f063b13392f32289e38c7d3164c9 (diff) |
Handle empty or unset TERM correctly; also fix a fatal() message while here.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/server-msg.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/tmux/server-msg.c b/usr.bin/tmux/server-msg.c index 17b67b6554a..d89831021f0 100644 --- a/usr.bin/tmux/server-msg.c +++ b/usr.bin/tmux/server-msg.c @@ -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> @@ -211,7 +211,9 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c) c->tty.term_flags |= TERM_88COLOURS; if (data.flags & IDENTIFY_HASDEFAULTS) c->tty.term_flags |= TERM_HASDEFAULTS; - xfree(term); + + if (term != NULL) + xfree(term); c->flags |= CLIENT_TERMINAL; diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index f482d824967..a180f89cb9e 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.8 2009/06/27 12:57:14 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> @@ -76,7 +76,7 @@ void tty_init(struct tty *tty, char *path, char *term) { tty->path = xstrdup(path); - if (term == NULL) + if (term == NULL || *term == '\0') tty->termname = xstrdup("unknown"); else tty->termname = xstrdup(term); @@ -98,7 +98,7 @@ tty_open(struct tty *tty, char **cause) if ((mode = fcntl(tty->fd, F_GETFL)) == -1) fatal("fcntl failed"); 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) fatal("fcntl failed"); |