aboutsummaryrefslogtreecommitdiff
path: root/bin/sqfsdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sqfsdiff')
-rw-r--r--bin/sqfsdiff/Makemodule.am4
-rw-r--r--bin/sqfsdiff/extract.c13
2 files changed, 9 insertions, 8 deletions
diff --git a/bin/sqfsdiff/Makemodule.am b/bin/sqfsdiff/Makemodule.am
index b5de502..8331f25 100644
--- a/bin/sqfsdiff/Makemodule.am
+++ b/bin/sqfsdiff/Makemodule.am
@@ -4,8 +4,8 @@ sqfsdiff_SOURCES += bin/sqfsdiff/compare_dir.c bin/sqfsdiff/node_compare.c
sqfsdiff_SOURCES += bin/sqfsdiff/compare_files.c bin/sqfsdiff/super.c
sqfsdiff_SOURCES += bin/sqfsdiff/extract.c
sqfsdiff_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-sqfsdiff_LDADD = libcommon.a libsquashfs.la libcompat.a $(LZO_LIBS) libfstree.a
-sqfsdiff_LDADD += $(PTHREAD_LIBS)
+sqfsdiff_LDADD = libcommon.a libsquashfs.la libfstream.a libcompat.a
+sqfsdiff_LDADD += $(LZO_LIBS) libfstree.a $(PTHREAD_LIBS)
dist_man1_MANS += bin/sqfsdiff/sqfsdiff.1
bin_PROGRAMS += sqfsdiff
diff --git a/bin/sqfsdiff/extract.c b/bin/sqfsdiff/extract.c
index 979572a..0c68918 100644
--- a/bin/sqfsdiff/extract.c
+++ b/bin/sqfsdiff/extract.c
@@ -10,7 +10,7 @@ static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
const char *prefix, const char *path, size_t block_size)
{
char *ptr, *temp;
- FILE *fp;
+ ostream_t *fp;
temp = alloca(strlen(prefix) + strlen(path) + 2);
sprintf(temp, "%s/%s", prefix, path);
@@ -21,19 +21,20 @@ static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
return -1;
*ptr = '/';
- fp = fopen(temp, "wb");
+ fp = ostream_open_file(temp, OSTREAM_OPEN_OVERWRITE |
+ OSTREAM_OPEN_SPARSE);
if (fp == NULL) {
perror(temp);
return -1;
}
- if (sqfs_data_reader_dump(path, data, inode, fp, block_size, true)) {
- fclose(fp);
+ if (sqfs_data_reader_dump(path, data, inode, fp, block_size)) {
+ sqfs_destroy(fp);
return -1;
}
- fflush(fp);
- fclose(fp);
+ ostream_flush(fp);
+ sqfs_destroy(fp);
return 0;
}