From 859746b30b759568cfdd2b4ae7bcfa995afda50b Mon Sep 17 00:00:00 2001 From: mirabilos Date: Sun, 26 Mar 2017 00:09:46 +0100 Subject: [PATCH] fix \r followed by something else than \n or EOF --- eval.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/eval.c b/eval.c index bd24c8a..3d2e14d 100644 --- a/eval.c +++ b/eval.c @@ -888,10 +888,16 @@ expand( { if (c == '\r') { c = shf_getc(x.u.shf); - if (c == -1) - c = '\r'; - else if (c != '\n') + switch (c) { + case '\n': + break; + default: shf_ungetc(c, x.u.shf); + /* FALLTHROUGH */ + case -1: + c = '\r'; + break; + } } #endif if (c == '\n')