summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index bdffcfff..3d596bd9 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -760,7 +760,8 @@ static int edit(int stdin_fd, int stdout_fd, char *buf, size_t buflen, const cha
char seq[3];
nread = read(l.ifd,&c,1);
- if (nread <= 0) return l.len;
+ if (nread <= 0)
+ return l.len ? l.len : -1;
/* Only autocomplete when the callback is set. It returns < 0 when
* there was an error reading from fd. Otherwise it will return the