summaryrefslogtreecommitdiff
path: root/difftool/extract.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-21 14:37:25 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-21 15:22:01 +0200
commit66e59bc2f10e35fbbbbaa7c4abff8a27148f00e4 (patch)
treed6c6af6e3e1d7a30c09dec824aa78a0e9741a7bd /difftool/extract.c
parent1c8e61f284ff04e3b63c46044d7b890a7e93e302 (diff)
Use "old" and "new" prefix when extracting files in sqfsdiff
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/extract.c')
-rw-r--r--difftool/extract.c13
1 files changed, 6 insertions, 7 deletions
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;