diff options
author | Rob Landley <rob@landley.net> | 2012-11-10 14:34:01 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-11-10 14:34:01 -0600 |
commit | ffba380a466e010e475462bdfacf0a7045f9e00b (patch) | |
tree | 80c3f312c28a2dd4eac120faf63babe22d09e4b3 /toys | |
parent | c65e89b70b5892d40d4fcab567e615aafcda688a (diff) | |
download | toybox-ffba380a466e010e475462bdfacf0a7045f9e00b.tar.gz |
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.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/patch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/patch.c b/toys/posix/patch.c index fae908db..5af07a14 100644 --- a/toys/posix/patch.c +++ b/toys/posix/patch.c @@ -387,7 +387,7 @@ void patch_main(void) // 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) { |