From: G.raud Meyer Date: Sat, 31 Mar 2018 13:01:27 +0000 (+0200) Subject: rename: ask(): print n when EOF on input X-Git-Tag: v2.33-rc1~309^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cb2c653c323a2eff3fe3ef931482c0c77634420;p=thirdparty%2Futil-linux.git rename: ask(): print n when EOF on input --- 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