summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/patch
diff options
context:
space:
mode:
authorhsu <hsu@FreeBSD.org>1995-01-12 22:09:40 +0000
committerhsu <hsu@FreeBSD.org>1995-01-12 22:09:40 +0000
commitb5ccaa010d78f402711c5dfe112cd078c08d8435 (patch)
tree4a908318d7f884e54582841828e1ec86e6fb35c0 /gnu/usr.bin/patch
parent1b3a308b0eebda837c1b87bfdfa8e2c805b7f375 (diff)
downloadFreeBSD-src-b5ccaa010d78f402711c5dfe112cd078c08d8435.zip
FreeBSD-src-b5ccaa010d78f402711c5dfe112cd078c08d8435.tar.gz
Fix bug that created new files even when running in -C check mode.
Reviewed by: phk
Diffstat (limited to 'gnu/usr.bin/patch')
-rw-r--r--gnu/usr.bin/patch/inp.c13
-rw-r--r--gnu/usr.bin/patch/patch.c7
2 files changed, 16 insertions, 4 deletions
diff --git a/gnu/usr.bin/patch/inp.c b/gnu/usr.bin/patch/inp.c
index c99054f..0d0e6af 100644
--- a/gnu/usr.bin/patch/inp.c
+++ b/gnu/usr.bin/patch/inp.c
@@ -1,6 +1,9 @@
-/* $Header: inp.c,v 2.0.1.1 88/06/03 15:06:13 lwall Locked $
+/* $Header: /home/ncvs/src/gnu/usr.bin/patch/inp.c,v 1.1.1.1 1993/06/19 14:21:52 paul Exp $
+ *
+ * $Log: inp.c,v $
+ * Revision 1.1.1.1 1993/06/19 14:21:52 paul
+ * b-maked patch-2.10
*
- * $Log: inp.c,v $
* Revision 2.0.1.1 88/06/03 15:06:13 lwall
* patch10: made a little smarter about sccs files
*
@@ -81,15 +84,21 @@ char *filename;
Reg2 LINENUM iline;
char lbuf[MAXLINELEN];
int output_elsewhere = strcmp(filename, outname);
+ extern int check_patch;
statfailed = stat(filename, &filestat);
if (statfailed && ok_to_create_file) {
if (verbose)
say2("(Creating file %s...)\n",filename);
+ if (check_patch)
+ return TRUE;
makedirs(filename, TRUE);
close(creat(filename, 0666));
statfailed = stat(filename, &filestat);
}
+ if (statfailed && check_patch) {
+ fatal2("%s not found and in check_patch mode.", filename);
+ }
/* For nonexistent or read-only files, look for RCS or SCCS versions. */
if (statfailed
|| (! output_elsewhere
diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c
index 626c453..c34ca83 100644
--- a/gnu/usr.bin/patch/patch.c
+++ b/gnu/usr.bin/patch/patch.c
@@ -1,5 +1,5 @@
char rcsid[] =
- "$Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.c,v 1.3 1994/02/17 22:20:34 jkh Exp $";
+ "$Header: /home/ncvs/src/gnu/usr.bin/patch/patch.c,v 1.4 1994/02/25 21:46:04 phk Exp $";
/* patch - a program to apply diffs to original files
*
@@ -9,6 +9,9 @@ char rcsid[] =
* money off of it, or pretend that you wrote it.
*
* $Log: patch.c,v $
+ * Revision 1.4 1994/02/25 21:46:04 phk
+ * added the -C/-check again.
+ *
* Revision 1.3 1994/02/17 22:20:34 jkh
* Put this back - I was somehow under the erroneous impression that patch was in
* ports, until I saw the the commit messages, that is! :-) All changed backed out.
@@ -135,7 +138,7 @@ static int remove_empty_files = FALSE;
static int reverse_flag_specified = FALSE;
/* TRUE if -C was specified on command line. */
-static int check_patch = FALSE;
+int check_patch = FALSE;
/* Apply a set of diffs as appropriate. */
OpenPOWER on IntegriCloud