Mercurial > hg > toybox
changeset 688:9791e462855a
Fix reversed test: patch creates a file if /dev/null or dated the epoch _and_ first hunk being replaced is 0 lines at start of file, not one or the other.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 10 Nov 2012 14:34:01 -0600 |
parents | 598263aee2b9 |
children | c29e69a0e85e |
files | toys/posix/patch.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/posix/patch.c Thu Nov 08 15:03:03 2012 -0600 +++ b/toys/posix/patch.c Sat Nov 10 14:34:01 2012 -0600 @@ -387,7 +387,7 @@ // If we've got a file to open, do so. } else if (!(toys.optflags & FLAG_p) || i <= TT.prefix) { // If the old file was null, we're creating a new one. - if (!strcmp(oldname, "/dev/null") || !oldsum) { + if (!strcmp(oldname, "/dev/null") && !oldsum) { printf("creating %s\n", name); s = strrchr(name, '/'); if (s) {