From 66e59bc2f10e35fbbbbaa7c4abff8a27148f00e4 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 21 Aug 2019 14:37:25 +0200 Subject: Use "old" and "new" prefix when extracting files in sqfsdiff Signed-off-by: David Oberhollenzer --- difftool/extract.c | 13 ++++++------- difftool/options.c | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'difftool') diff --git a/difftool/extract.c b/difftool/extract.c index cefba62..9fec818 100644 --- a/difftool/extract.c +++ b/difftool/extract.c @@ -7,14 +7,13 @@ #include "sqfsdiff.h" static int extract(data_reader_t *data, file_info_t *fi, - const char *path, char prefix) + const char *prefix, const char *path) { - char *ptr, *temp = alloca(strlen(path) + 3); + char *ptr, *temp; int fd; - temp[0] = prefix; - temp[1] = '/'; - strcpy(temp + 2, path); + temp = alloca(strlen(prefix) + strlen(path) + 2); + sprintf(temp, "%s/%s", prefix, path); ptr = strrchr(temp, '/'); *ptr = '\0'; @@ -41,12 +40,12 @@ int extract_files(sqfsdiff_t *sd, file_info_t *old, file_info_t *new, const char *path) { if (old != NULL && !sd->old_is_dir) { - if (extract(sd->sqfs_old.data, old, path, 'a')) + if (extract(sd->sqfs_old.data, old, "old", path)) return -1; } if (new != NULL && !sd->new_is_dir) { - if (extract(sd->sqfs_new.data, new, path, 'b')) + if (extract(sd->sqfs_new.data, new, "new", path)) return -1; } return 0; diff --git a/difftool/options.c b/difftool/options.c index 8224b1d..149f736 100644 --- a/difftool/options.c +++ b/difftool/options.c @@ -52,9 +52,9 @@ static const char *usagestr = " --super, -S Also compare metadata in super blocks.\n" "\n" " --extract, -e Extract files that differ to the specified\n" -" directory. Contents of the first image end up\n" -" in a subdirectory 'a' and of the second image\n" -" in a subdirectory 'b'.\n" +" directory. Contents of the first filesystem\n" +" end up in a subdirectory 'old' and of the\n" +" second filesystem in a subdirectory 'new'.\n" "\n" " --help, -h Print help text and exit.\n" " --version, -V Print version information and exit.\n" -- cgit v1.2.3