mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-22 00:42:06 +01:00
Fix bug that created new files even when running in -C check mode.
Reviewed by: phk
This commit is contained in:
parent
7ba7177c6e
commit
add65270a0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5556
@ -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
|
||||
|
@ -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. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user