summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/patch.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2012-05-15 19:32:02 +0000
committermillert <millert@openbsd.org>2012-05-15 19:32:02 +0000
commitfa594d348c2beb6c7ae477c77d227fa8afa93c71 (patch)
tree03c70ddc8b11222a4cb90dc0813a0fa8cfc256c9 /usr.bin/patch/patch.c
parentrevert a chunk introduced in 1.7 which was not supposed to be there yet (diff)
downloadwireguard-openbsd-fa594d348c2beb6c7ae477c77d227fa8afa93c71.tar.xz
wireguard-openbsd-fa594d348c2beb6c7ae477c77d227fa8afa93c71.zip
Fix confusing patch(1) output on failure when using -C. From
dragonflybsd via Loganaden Velvindron. OK mikeb@ and deraadt@
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r--usr.bin/patch/patch.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 19e41c42295..687ccc8b0f1 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch.c,v 1.49 2010/07/24 01:10:12 ray Exp $ */
+/* $OpenBSD: patch.c,v 1.50 2012/05/15 19:32:02 millert Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -383,13 +383,12 @@ main(int argc, char *argv[])
sizeof(rejname)) >= sizeof(rejname))
fatal("filename %s is too long\n", outname);
}
- if (skip_rest_of_patch) {
- say("%d out of %d hunks ignored--saving rejects to %s\n",
- failed, hunk, rejname);
- } else {
- say("%d out of %d hunks failed--saving rejects to %s\n",
- failed, hunk, rejname);
- }
+ if (!check_only)
+ say("%d out of %d hunks %s--saving rejects to %s\n",
+ failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname);
+ else
+ say("%d out of %d hunks %s\n",
+ failed, hunk, skip_rest_of_patch ? "ignored" : "failed");
if (!check_only && move_file(TMPREJNAME, rejname) < 0)
trejkeep = true;
}