From cb7ccfbb9f5893350c0aa3b0aa98a703f2a9ec07 Mon Sep 17 00:00:00 2001 From: Matthew Nourse Date: Thu, 27 Nov 2025 16:35:10 +1100 Subject: [PATCH] Multiplexing: if lineNoiseEditFeed is called when there are no bytes available on the open input fd then return linenoiseEditMore rather than NULL. --- linenoise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linenoise.c b/linenoise.c index ac27f06..b40bbbe 100644 --- a/linenoise.c +++ b/linenoise.c @@ -935,7 +935,8 @@ char *linenoiseEditFeed(struct linenoiseState *l) { char seq[3]; nread = read(l->ifd,&c,1); - if (nread <= 0) return NULL; + if (nread < 0) return ((EAGAIN == errno) || (EWOULDBLOCK == errno)) ? linenoiseEditMore : NULL; + if (0 == nread) return NULL; /* Only autocomplete when the callback is set. It returns < 0 when * there was an error reading from fd. Otherwise it will return the