retry patch using cache if in-place write fails
[cherry-pick from donut branch]
Instead of failing outright when yaffs lies about how much space is
free on the filesystem, delete the partially-written output file and
retry using the copy-source-to-cache method instead.
Change all the log statements to printf; mixing stdout and stderr
logging just makes the logs hard to read because they're buffered
differently.
diff --git a/tools/applypatch/main.c b/tools/applypatch/main.c
index e25c730..e08f5c1 100644
--- a/tools/applypatch/main.c
+++ b/tools/applypatch/main.c
@@ -44,7 +44,7 @@
int main(int argc, char** argv) {
int result = applypatch(argc, argv);
if (result == 2) {
- fprintf(stderr,
+ printf(
"usage: %s <src-file> <tgt-file> <tgt-sha1> <tgt-size> "
"[<src-sha1>:<patch> ...]\n"
" or %s -c <file> [<sha1> ...]\n"