Merge "applypatch: Add determine the return value of ApplyDiffPatch and capture the error flow." am: ac78ed8915 am: 282c863524 am: 3dcc24490b
am: ce5e980835
Change-Id: Ic8852e654a36a90c99a505fb5b2af6182aaff30d
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index 7d8b736..3d905f7 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -100,7 +100,10 @@
printf("source data too short\n");
return -1;
}
- ApplyBSDiffPatch(old_data + src_start, src_len, patch, patch_offset, sink, ctx);
+ if (ApplyBSDiffPatch(old_data + src_start, src_len, patch, patch_offset, sink, ctx) != 0) {
+ printf("Failed to apply bsdiff patch.\n");
+ return -1;
+ }
} else if (type == CHUNK_RAW) {
const char* raw_header = &patch->data[pos];
pos += 4;