# HG changeset patch # User Rob Landley # Date 1352579641 21600 # Node ID 9791e462855a79ff8b94d3b74dd0efa48b5b6006 # Parent 598263aee2b97d526a8e58d2884d67b8a726efb3 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. diff -r 598263aee2b9 -r 9791e462855a toys/posix/patch.c --- 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) {