OSDN Git Service
(root)
/
android-x86
/
external-toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a85348
)
Yet another attempt to get the fiddly patch file creation logic right.
author
Rob Landley
<rob@landley.net>
Mon, 12 Nov 2012 08:59:56 +0000
(
02:59
-0600)
committer
Rob Landley
<rob@landley.net>
Mon, 12 Nov 2012 08:59:56 +0000
(
02:59
-0600)
toys/posix/patch.c
patch
|
blob
|
history
diff --git
a/toys/posix/patch.c
b/toys/posix/patch.c
index
5af07a1
..
40d7cbc
100644
(file)
--- a/
toys/posix/patch.c
+++ b/
toys/posix/patch.c
@@
-387,7
+387,9
@@
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)
+ && access(name, F_OK))
+ {
printf("creating %s\n", name);
s = strrchr(name, '/');
if (s) {