]> git.lizzy.rs Git - linenoise.git/blobdiff - linenoise.c
Bug fix. Ensure that current->cols is initialized
[linenoise.git] / linenoise.c
index 7c6eb995d1fa100fad768bb27ae3295dcc643aa9..87513cc7e1e39d7efcd25d66e4ebac4262941f54 100644 (file)
@@ -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;
 }