From 7275e31da65bf6e9c20bbd0dc054df550c2caf2d Mon Sep 17 00:00:00 2001
From: christos <christos>
Date: Mon, 28 Nov 2016 17:14:20 +0000
Subject: [PATCH] Fix type of read in prompt confirmation (eg. rmstar) (David
Kaspar)
---
Fixes | 1 +
sh.func.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Fixes b/Fixes
index c1b4537..2b7b55f 100644
--- a/Fixes
+++ b/Fixes
@@ -1,3 +1,4 @@
+ 22. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
14. Fix drawing issu with multi-line prompt (Kensuke Iwahashi/David Kaspar)
12. PR/526: Fix double \\ printing from previous fix in history expansion.
10. PR/526: Quote backslashes properly so they can be preserved in ``
diff --git a/sh.func.c b/sh.func.c
index 7cba84d..42c74c6 100644
--- a/sh.func.c
+++ b/sh.func.c
@@ -2726,16 +2726,18 @@ nlsclose(void)
int
getYN(const char *prompt)
{
- int doit, c;
+ int doit;
+ char c;
+
xprintf("%s", prompt);
flush();
- (void) force_read(SHIN, &c, 1);
+ (void) force_read(SHIN, &c, sizeof(c));
/*
* Perhaps we should use the yesexpr from the
* actual locale
*/
doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
- while (c != '\n' && force_read(SHIN, &c, 1) == 1)
+ while (c != '\n' && force_read(SHIN, &c, sizeof(c)) == sizeof(c))
continue;
return doit;
}
--
2.7.4