diff options
author | Alex Deymo <deymo@chromium.org> | 2015-04-24 18:51:34 -0700 |
---|---|---|
committer | Alex Deymo <deymo@google.com> | 2015-09-23 10:06:36 -0700 |
commit | f3767966ffaa0f6f42130ea94621e48fcb675c30 (patch) | |
tree | 34a6ca0a620fc19d081da788e0d205f8cb47d457 | |
parent | a5cff2283b9bc60da9f4e74ba07a2119f5616653 (diff) | |
download | bsdiff-f3767966ffaa0f6f42130ea94621e48fcb675c30.tar.gz |
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
-rw-r--r-- | bspatch.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |