summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2016-09-02 09:48:04 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2016-09-02 09:48:04 +0000
commit02647f4aae7f5879d92879db066a50420a432865 (patch)
treef343682dc2f79736e13d77b74ae6909f4dd1ed54 /usr.bin
parentaa09b1001685db4d86a566faca4af8dc42fe9f34 (diff)
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@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/patch/pch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 46e5414fc6e..dcf7b414189 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pch.c,v 1.54 2015/10/16 07:33:47 tobias Exp $ */
+/* $OpenBSD: pch.c,v 1.55 2016/09/02 09:48:03 otto Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -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");