diff options
author | 2016-09-02 09:48:03 +0000 | |
---|---|---|
committer | 2016-09-02 09:48:03 +0000 | |
commit | f52807d81b4232945e598e3f62b92b32ccea0314 (patch) | |
tree | e54a7bb8d01bfb928232e7e78ba9bdd29abb3071 | |
parent | Don't bother with 'ghpartnum' in gpt_chk_hdr(); it's not used (diff) | |
download | wireguard-openbsd-f52807d81b4232945e598e3f62b92b32ccea0314.tar.xz wireguard-openbsd-f52807d81b4232945e598e3f62b92b32ccea0314.zip |
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-- | usr.bin/patch/pch.c | 8 |
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"); |