From 9f3e3e5d9d8652e8df91c66aae7ecd9f5e8769ae Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 18 Jun 2015 18:00:06 -0700 Subject: [PATCH] empty line means no for -ok (also protect against glibc EOF bug) --- find.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/find.c b/find.c index 186263b..f56e0bb 100644 --- a/find.c +++ b/find.c @@ -415,10 +415,9 @@ pri_ok(struct arg *arg) reply = fgetc(stdin); /* throw away rest of line */ - while ((c = fgetc(stdin)) != '\n' && c != EOF) - /* FIXME: what if the first character of the rest of the line is a null - * byte? */ - ; + if (reply != '\n' && reply != EOF) + while ((c = fgetc(stdin)) != '\n' && c != EOF) + ; if (feof(stdin)) /* FIXME: ferror()? */ clearerr(stdin); -- 2.4.4