From 182e489d9bc1b935fc5494b5c9ef47f47a6173d5 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 28 Aug 2022 11:10:13 +0100 Subject: make: fix incorrect handling of escaped newline Fix a bug in process_command() where an escaped newline followed by a character other than tab resulted in premature termination of the command. --- miscutils/make.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/miscutils/make.c b/miscutils/make.c index b92819266..21d0ede51 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -1402,11 +1402,10 @@ process_command(char *s) // Remove tab following escaped newline. Stop processing at a // non-escaped newline. for (t = u = s; *u && *u != '\n'; u++) { - if (u[0] == '\\' && u[1] == '\n' && u[2] == '\t') { - *t++ = *u++; - *t++ = *u++; - } else { - *t++ = *u; + *t++ = *u; + if (u[0] == '\\' && u[1] == '\n') { + *t++ = '\n'; + u += (u[2] == '\t') ? 2 : 1; } } *t = '\0'; -- cgit v1.2.3-55-g6feb