summaryrefslogtreecommitdiff
path: root/difftool/compare_files_sqfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-09 11:43:15 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-09 12:11:12 +0200
commitb3c3401aee91bc2ff46ba0eab0ceb88c78cb5bbb (patch)
tree097241e9080420385db37a3985c5beabe42cb57b /difftool/compare_files_sqfs.c
parentfd98948e840f6e67cd2d7c72f57d2fd80ed9a418 (diff)
Add option to sqfsdiff to extract regular files that are different
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/compare_files_sqfs.c')
-rw-r--r--difftool/compare_files_sqfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/difftool/compare_files_sqfs.c b/difftool/compare_files_sqfs.c
index 76fae7a..32b97b1 100644
--- a/difftool/compare_files_sqfs.c
+++ b/difftool/compare_files_sqfs.c
@@ -15,7 +15,7 @@ int compare_files(file_info_t *a, file_info_t *b, const char *path)
ssize_t ret;
if (a->size != b->size)
- return 1;
+ goto out_different;
if (compare_flags & COMPARE_NO_CONTENTS)
return 0;
@@ -41,8 +41,14 @@ int compare_files(file_info_t *a, file_info_t *b, const char *path)
}
if (memcmp(a_buf, b_buf, diff) != 0)
- return 1;
+ goto out_different;
}
return 0;
+out_different:
+ if (compare_flags & COMPARE_EXTRACT_FILES) {
+ if (extract_files(a, b, path))
+ return -1;
+ }
+ return 1;
}