From: Andreas Kupries Date: Fri, 18 Oct 2013 20:38:07 +0000 (-0700) Subject: Bug fix. Ensure that current->cols is initialized X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=d0b3b36a72dcd058687b0018f2b4b82d21e768bb;p=linenoise.git Bug fix. Ensure that current->cols is initialized Even when both stdin/stdout are redirected (which prevents the raw mode from getting set). --- diff --git a/linenoise.c b/linenoise.c index 7c6eb99..87513cc 100644 --- a/linenoise.c +++ b/linenoise.c @@ -221,6 +221,7 @@ static int enableRawMode(struct current *current) { struct termios raw; current->fd = STDIN_FILENO; + current->cols = 0; if (!isatty(current->fd) || isUnsupportedTerm() || tcgetattr(current->fd, &orig_termios) == -1) { @@ -254,8 +255,6 @@ fatal: goto fatal; } rawmode = 1; - - current->cols = 0; return 0; }