summaryrefslogtreecommitdiff
path: root/usr.bin/patch/pch.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-07-25 02:12:46 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-07-25 02:12:46 +0000
commit3d20201d8f84a8462bad6ba9c703a1a14ad5dee1 (patch)
tree64be85ba6f56bc9fd775cf808b26dd3006edc6cd /usr.bin/patch/pch.c
parent4979527ac89a23153e53f1107c12df9d47a529b2 (diff)
Add POSIX -b option but don't change the default beahvior wrt backups
yet. The old -b option is now -z (matches GNU patch).
Diffstat (limited to 'usr.bin/patch/pch.c')
-rw-r--r--usr.bin/patch/pch.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index e59eec91429..dbe00665af6 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: pch.c,v 1.23 2003/07/22 17:52:20 deraadt Exp $ */
+/* $OpenBSD: pch.c,v 1.24 2003/07/25 02:12:45 millert Exp $ */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: pch.c,v 1.23 2003/07/22 17:52:20 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: pch.c,v 1.24 2003/07/25 02:12:45 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -1315,8 +1315,10 @@ do_ed_script(void)
FILE *pipefp;
if (!skip_rest_of_patch) {
- unlink(TMPOUTNAME);
- copy_file(filearg[0], TMPOUTNAME);
+ if (copy_file(filearg[0], TMPOUTNAME) < 0) {
+ unlink(TMPOUTNAME);
+ fatal("can't create temp file %s", TMPOUTNAME);
+ }
if (verbose)
snprintf(buf, sizeof buf, "/bin/ed %s", TMPOUTNAME);
else