summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeremy Condra <gcondra@google.com>2014-04-10 15:28:36 -0700
committerGeremy Condra <gcondra@google.com>2014-04-10 15:36:20 -0700
commit4029ced07661bbe144d290b390cd56406111dbf8 (patch)
treeb3365160cafd1c9ea96514cbf0ca34255a2f0101
parentce63e8fd12df8bb8c1e5ac7136d0c28b2a8d38ad (diff)
downloadsyspatch-l-preview.tar.gz
Increment TARGET_WINDOWS_WRITTEN after stream_to_target_write.l-preview
Prior to this, TARGET_WINDOWS_WRITTEN would be incremented before the call to stream_to_target_write if the target was nonzero size and write_target succeeded. This caused tgt->start to be set incorrectly. This confused mapio but not xdelta, leading to correct target windows written to incorrect locations. Change-Id: I76db5281a749a20d0e63b8126238eb1886d87a1c
-rw-r--r--syspatch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/syspatch.c b/syspatch.c
index a90e031..3b7b24c 100644
--- a/syspatch.c
+++ b/syspatch.c
@@ -196,10 +196,12 @@ static int advance_target_buffer(xd3_stream *stream, MapState *target_state) {
if (tgt->length) {
if (write_target(tgt, target_state) != 0)
return -1;
- TARGET_WINDOWS_WRITTEN += 1;
}
if (stream_to_target_write(stream, tgt) != 0)
return -1;
+ if (tgt->length) {
+ TARGET_WINDOWS_WRITTEN += 1;
+ }
return 0;
}