diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-07-13 18:01:09 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-07-13 18:01:09 +0100 |
commit | 07aef385910f46e09804756231ff1ef3e304e023 (patch) | |
tree | 934330dfd6943a981ee7a935aa8d818a9ccfadd4 /tty.c | |
parent | 38d4d696391123da266c9d38ed65bba7076e1147 (diff) | |
parent | e45d624df288d914a1628d373ff245b03f7d600b (diff) | |
download | rtmux-07aef385910f46e09804756231ff1ef3e304e023.tar.gz rtmux-07aef385910f46e09804756231ff1ef3e304e023.tar.bz2 rtmux-07aef385910f46e09804756231ff1ef3e304e023.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -59,11 +59,14 @@ void tty_default_colours(struct grid_cell *, const struct window_pane *); #define tty_pane_full_width(tty, ctx) \ ((ctx)->xoff == 0 && screen_size_x((ctx)->wp->screen) >= (tty)->sx) -void +int tty_init(struct tty *tty, struct client *c, int fd, char *term) { char *path; + if (!isatty(fd)) + return (-1); + memset(tty, 0, sizeof *tty); tty->log_fd = -1; @@ -75,13 +78,15 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term) tty->client = c; if ((path = ttyname(fd)) == NULL) - fatalx("ttyname failed"); + return (-1); tty->path = xstrdup(path); tty->cstyle = 0; tty->ccolour = xstrdup(""); tty->flags = 0; tty->term_flags = 0; + + return (0); } int |