diff options
author | Andreas Gruenbacher <agruen@gnu.org> | 2018-04-06 11:34:51 +0200 |
---|---|---|
committer | Andreas Gruenbacher <agruen@gnu.org> | 2018-04-06 12:23:02 +0200 |
commit | b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 (patch) | |
tree | cd32adabab856ce9a0f813bbc4d9db76fd2c7411 | |
parent | f290f48a621867084884bfff87f8093c15195e6a (diff) | |
download | patch-b5a91a01e5d0897facdd0f49d64b76b0f02b43e1.tar.gz |
Allow input files to be missing for ed-style patches
* src/pch.c (do_ed_script): Allow input files to be missing so that new
files will be created as with non-ed-style patches.
-rw-r--r-- | src/pch.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname, if (! dry_run && ! skip_rest_of_patch) { int exclusive = *outname_needs_removal ? 0 : O_EXCL; - assert (! inerrno); - *outname_needs_removal = true; - copy_file (inname, outname, 0, exclusive, instat.st_mode, true); + if (inerrno != ENOENT) + { + *outname_needs_removal = true; + copy_file (inname, outname, 0, exclusive, instat.st_mode, true); + } sprintf (buf, "%s %s%s", editor_program, verbosity == VERBOSE ? "" : "- ", outname); |