X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fyesno.c;h=2f3eea2608f6cc5b157adcfdb191ac625c923ada;hb=ecea6a7078983379e5b4d8961337cc55298aa8b1;hp=f379cf87e8c44f951b962d974052fd2d1f1b747e;hpb=dc84183747ce1703eb99685b5dbde1f65a143c06;p=debian%2Fgzip
diff --git a/lib/yesno.c b/lib/yesno.c
index f379cf8..2f3eea2 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-2012 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1998, 2001, 2003-2018 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
@@ -13,7 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
+ along with this program. If not, see . */
#include
@@ -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));
}