From 0cb2c653c323a2eff3fe3ef931482c0c77634420 Mon Sep 17 00:00:00 2001 From: "G.raud Meyer" Date: Sat, 31 Mar 2018 15:01:27 +0200 Subject: [PATCH] rename: ask(): print n when EOF on input --- misc-utils/rename.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc-utils/rename.c b/misc-utils/rename.c index 1c24d7e329..032a039bfa 100644 --- a/misc-utils/rename.c +++ b/misc-utils/rename.c @@ -65,17 +65,18 @@ static int ask(char *name) printf(_("%s: overwrite `%s'? "), program_invocation_short_name, name); fflush(stdout); if ((c = fgetc(stdin)) == EOF) { - buf[0] = '\0'; + buf[0] = 'n'; clearerr(stdin); errno = 0; - printf("\n"); + printf("n\n"); } else { - buf[0] = c; buf[1] = '\0'; + buf[0] = c; if (c != '\n' && tty_cbreak) /* no purge necessary */ printf("\n"); else if (c != '\n') while ((c = fgetc(stdin)) != '\n' && c != EOF); } + buf[1] = '\0'; if (rpmatch(buf) == RPMATCH_YES) return 0; else -- 2.47.3