Mercurial > hg > toybox
changeset 690:a81cf364764d
Yet another attempt to get the fiddly patch file creation logic right.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 12 Nov 2012 02:59:56 -0600 |
parents | c29e69a0e85e |
children | 8871e8002812 |
files | toys/posix/patch.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/posix/patch.c Sat Nov 10 18:24:14 2012 -0600 +++ b/toys/posix/patch.c Mon Nov 12 02:59:56 2012 -0600 @@ -387,7 +387,9 @@ // 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) + && access(name, F_OK)) + { printf("creating %s\n", name); s = strrchr(name, '/'); if (s) {