bspatch: Fix arg names.

In last CL we introduced a bug where the old_filename was mixed with
the new_filename. This obvious bug didn't trigger any failure because
update_engine uses always the same name (/dev/fd/N) for both old and
new files since the files are applied in place, and also because bsdiff
doesn't have any unittest... yet.

BUG=None
TEST=sudo emerge bsdiff; tested bspatch manually.
TEST=cros flash an image with payload minor_version=2, which uses different old and new files.

Change-Id: I8b5715cd422612b9bbf7eaf3d4d3813c659fd10c
This commit is contained in:
Alex Deymo authored and Alex Deymo committed 2015-09-23 10:06:36 -07:00
1 parent a5cff2283b
commit f3767966ff
1 file changed
+3 -3
+3 -3
View File
@@ -160,16 +160,16 @@ int bspatch(
if (using_extents) {
size_t ex_count = 0;
ex_t *ex_arr = parse_extent_str(old_extents, &ex_count);
old_file = exfile_fopen(new_filename, "r", ex_arr, ex_count,
old_file = exfile_fopen(old_filename, "r", ex_arr, ex_count,
free);
} else {
old_file = fopen(new_filename, "r");
old_file = fopen(old_filename, "r");
}
if (!old_file ||
fseek(old_file, 0, SEEK_END) != 0 ||
(oldsize = ftell(old_file)) < 0 ||
fseek(old_file, 0, SEEK_SET) != 0)
err(1, "cannot obtain the size of %s", new_filename);
err(1, "cannot obtain the size of %s", old_filename);
off_t old_file_pos = 0;
if((new=malloc(newsize+1))==NULL) err(1,NULL);