mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-27 01:44:34 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d161c9a9db | ||
|
|
4c302306a8 | ||
|
|
aea66268c9 | ||
|
|
77c27209f6 |
2
NEWS
2
NEWS
@ -1,3 +1,5 @@
|
||||
Unreleased changes:
|
||||
|
||||
Changes in version 2.8:
|
||||
|
||||
* The --follow-symlinks option now applies to output files as well as input.
|
||||
|
||||
2
cfg.mk
2
cfg.mk
@ -18,6 +18,8 @@ config_h_header = <(common|config)\.h>
|
||||
|
||||
ifeq ($(RELEASE_TYPE),alpha)
|
||||
news-check-regexp = "Unreleased changes"
|
||||
else
|
||||
news-check-regexp = '^Changes in version $(VERSION_REGEXP):'
|
||||
endif
|
||||
|
||||
release-prep-hook =
|
||||
|
||||
10
src/patch.c
10
src/patch.c
@ -204,7 +204,10 @@ main (int argc, char **argv)
|
||||
|
||||
init_output (&outstate);
|
||||
if (outfile)
|
||||
outstate.ofp = open_outfile (outfile);
|
||||
{
|
||||
outstate.ofp = open_outfile (outfile);
|
||||
read_only_behavior = RO_IGNORE;
|
||||
}
|
||||
|
||||
/* Make sure we clean up in case of disaster. */
|
||||
init_signals ();
|
||||
@ -323,7 +326,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (read_only_behavior != RO_IGNORE
|
||||
if (! skip_rest_of_patch
|
||||
&& read_only_behavior != RO_IGNORE
|
||||
&& ! inerrno && ! S_ISLNK (instat.st_mode)
|
||||
&& safe_access (inname, W_OK) != 0)
|
||||
{
|
||||
@ -616,7 +620,7 @@ main (int argc, char **argv)
|
||||
struct stat outstat;
|
||||
|
||||
if (stat_file (outname, &outstat) != 0)
|
||||
say ("Cannot stat file %s, skipping backup\n", outname);
|
||||
say ("Cannot stat file %s, skipping backup\n", quotearg (outname));
|
||||
else
|
||||
output_file (&(struct outfile) { .name = outname },
|
||||
&outstat, nullptr, nullptr,
|
||||
|
||||
@ -571,6 +571,8 @@ safe_xstat (char *pathname, struct stat *buf, int flags)
|
||||
int dirfd = traverse_path (&pathname, false);
|
||||
if (dirfd == DIRFD_INVALID)
|
||||
return -1;
|
||||
if (! strcmp (pathname, ""))
|
||||
return EINVAL;
|
||||
return fstatat (dirfd, pathname, buf, flags);
|
||||
}
|
||||
|
||||
|
||||
@ -200,3 +200,11 @@ No file to patch. Skipping patch.
|
||||
1 out of 1 hunk ignored
|
||||
status: 1
|
||||
EOF
|
||||
|
||||
# Empty filenames are not allowed:
|
||||
|
||||
check 'emit_patch f | patch -r- "" || echo status: $?' <<EOF
|
||||
File '' is not a regular file -- refusing to patch
|
||||
1 out of 1 hunk ignored
|
||||
status: 1
|
||||
EOF
|
||||
|
||||
@ -67,3 +67,8 @@ check 'patch -f -p0 --read-only=ignore < f.diff || echo "Status: $?"' <<EOF
|
||||
patching file f
|
||||
patching file f
|
||||
EOF
|
||||
|
||||
check 'patch -o - f /dev/null || echo "Status: $?"' <<EOF
|
||||
patching file - (read from f)
|
||||
three
|
||||
EOF
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user