aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-07 17:24:32 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-07 17:24:32 +0000
commit474fdebb7abf08aecbcf00a92b7d53cd9528649c (patch)
tree9549b7d382a3613a903525c11c8f27bdc22a7d35 /tty.c
parent9ced016cbce01342b414a7aedaa0fe6c8f03d671 (diff)
downloadrtmux-474fdebb7abf08aecbcf00a92b7d53cd9528649c.tar.gz
rtmux-474fdebb7abf08aecbcf00a92b7d53cd9528649c.tar.bz2
rtmux-474fdebb7abf08aecbcf00a92b7d53cd9528649c.zip
Handle empty or unset TERM correctly; also fix a fatal() message while here.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tty.c b/tty.c
index 75986ef0..1ce8b226 100644
--- a/tty.c
+++ b/tty.c
@@ -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");