aboutsummaryrefslogtreecommitdiff
path: root/unpack
diff options
context:
space:
mode:
Diffstat (limited to 'unpack')
-rw-r--r--unpack/fill_files.c13
-rw-r--r--unpack/rdsquashfs.c3
2 files changed, 8 insertions, 8 deletions
diff --git a/unpack/fill_files.c b/unpack/fill_files.c
index e6444b2..d22e9d1 100644
--- a/unpack/fill_files.c
+++ b/unpack/fill_files.c
@@ -136,11 +136,11 @@ static int gen_file_list_dfs(const sqfs_tree_node_t *n)
static int fill_files(sqfs_data_reader_t *data, int flags)
{
size_t i;
- int fd;
+ FILE *fp;
for (i = 0; i < num_files; ++i) {
- fd = open(files[i].path, O_WRONLY);
- if (fd < 0) {
+ fp = fopen(files[i].path, "wb");
+ if (fp == NULL) {
fprintf(stderr, "unpacking %s: %s\n",
files[i].path, strerror(errno));
return -1;
@@ -150,13 +150,14 @@ static int fill_files(sqfs_data_reader_t *data, int flags)
printf("unpacking %s\n", files[i].path);
if (sqfs_data_reader_dump(files[i].path, data, files[i].inode,
- fd, block_size,
+ fp, block_size,
(flags & UNPACK_NO_SPARSE) == 0)) {
- close(fd);
+ fclose(fp);
return -1;
}
- close(fd);
+ fflush(fp);
+ fclose(fp);
}
return 0;
diff --git a/unpack/rdsquashfs.c b/unpack/rdsquashfs.c
index 5ef367b..2f84264 100644
--- a/unpack/rdsquashfs.c
+++ b/unpack/rdsquashfs.c
@@ -128,8 +128,7 @@ int main(int argc, char **argv)
}
if (sqfs_data_reader_dump(opt.cmdpath, data, n->inode,
- STDOUT_FILENO,
- super.block_size, false)) {
+ stdout, super.block_size, false)) {
goto out;
}
break;