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
diff --git a/bspatch.c b/bspatch.c index b44991c..56e1917 100644 --- a/bspatch.c +++ b/bspatch.c
@@ -159,16 +159,16 @@ 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);