From 71cd8e3a743046573744123777061b64881bf372 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sat, 4 Jul 2015 17:13:50 +0300 Subject: Imported Upstream version 8.24 --- lib/yesno.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/yesno.c') diff --git a/lib/yesno.c b/lib/yesno.c index ddb34454..331a4083 100644 --- a/lib/yesno.c +++ b/lib/yesno.c @@ -1,6 +1,6 @@ /* yesno.c -- read a yes/no response from stdin - Copyright (C) 1990, 1998, 2001, 2003-2014 Free Software Foundation, Inc. + Copyright (C) 1990, 1998, 2001, 2003-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,10 @@ yesno (void) yes = false; else { - response[response_len - 1] = '\0'; + /* Remove EOL if present as that's not part of the matched response, + and not matched by $ for example. */ + if (response[response_len - 1] == '\n') + response[response_len - 1] = '\0'; yes = (0 < rpmatch (response)); } -- cgit v1.2.3