Commit 94cbdd6540a79b5a3fda81a0044cf47fe2c2f0d9

Salvatore Sanfilippo 2014-03-12T16:22:13

Merge pull request #49 from polch/master_fixes fix linenoiseEdit buflen decreasing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/linenoise.c b/linenoise.c
index d0e3b0d..5d01c1d 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -663,8 +663,8 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen, 
     l.history_index = 0;
 
     /* Buffer starts empty. */
-    buf[0] = '\0';
-    buflen--; /* Make sure there is always space for the nulterm */
+    l.buf[0] = '\0';
+    l.buflen--; /* Make sure there is always space for the nulterm */
 
     /* The latest history entry is always our current buffer, that
      * initially is just an empty string. */