As Wolfgang pointed out if the user hit return at the prompt for -ok
another return was needed to continue. This patch fixes that accepting
an empty line as no.

-emg
From 65656d9b2aaf63c518a0e461c373bb7392b5653e Mon Sep 17 00:00:00 2001
From: Evan Gates <evan.ga...@gmail.com>
Date: Thu, 18 Jun 2015 14:43:11 -0700
Subject: [PATCH] empty line means no for -ok

---
 find.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/find.c b/find.c
index 186263b..0de1951 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 (c != '\n')
+               while ((c = fgetc(stdin)) != '\n' && c != EOF)
+                       ;
 
        if (feof(stdin)) /* FIXME: ferror()? */
                clearerr(stdin);
-- 
2.4.4

Reply via email to