summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorotto <otto>2016-09-02 09:48:03 +0000
committerotto <otto>2016-09-02 09:48:03 +0000
commitc173d70324703dcc8dc6338ca22ef2d8831dfdd0 (patch)
tree7b91e0ec3cfad166455ae163fdf5e586e3e15290
parentc75fd84ee574f6c9cc4079a65740c8a17a41e2a5 (diff)
downloadpatch-c173d70324703dcc8dc6338ca22ef2d8831dfdd0.tar
patch-c173d70324703dcc8dc6338ca22ef2d8831dfdd0.tar.gz
If reading fails, do not go into infinite loop asking for a filename
Happens in bulf build where no tty is available. ok sthen@ naddy@ $(jot -b yes 1000) landry@
-rw-r--r--pch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pch.c b/pch.c
index 2807acb..985c10d 100644
--- a/pch.c
+++ b/pch.c
@@ -225,8 +225,10 @@ there_is_another_patch(void)
filearg[0] = fetchname(buf, &exists, 0);
}
if (!exists) {
- ask("No file found--skip this patch? [n] ");
- if (*buf != 'y')
+ int def_skip = *bestguess == '\0';
+ ask("No file found--skip this patch? [%c] ",
+ def_skip ? 'y' : 'n');
+ if (*buf == 'n' || (!def_skip && *buf != 'y'))
continue;
if (verbose)
say("Skipping patch...\n");