aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/gensquashfs/Makemodule.am2
-rw-r--r--bin/gensquashfs/src/filemap_xattr.c8
-rw-r--r--bin/gensquashfs/src/fstree_from_file.c6
-rw-r--r--bin/gensquashfs/src/mkfs.c6
-rw-r--r--bin/rdsquashfs/src/fill_files.c14
-rw-r--r--bin/rdsquashfs/src/rdsquashfs.c7
-rw-r--r--bin/sqfs2tar/src/sqfs2tar.c11
-rw-r--r--bin/sqfs2tar/src/write_tree.c11
-rw-r--r--bin/sqfsdiff/src/extract.c15
-rw-r--r--bin/tar2sqfs/src/tar2sqfs.c7
10 files changed, 62 insertions, 25 deletions
diff --git a/bin/gensquashfs/Makemodule.am b/bin/gensquashfs/Makemodule.am
index 98153cb..dd32d5a 100644
--- a/bin/gensquashfs/Makemodule.am
+++ b/bin/gensquashfs/Makemodule.am
@@ -26,7 +26,7 @@ test_filemap_xattr_SOURCES = bin/gensquashfs/test/filemap_xattr.c \
test_filemap_xattr_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/bin/gensquashfs/src
test_filemap_xattr_CPPFLAGS += -DTESTPATH=$(GENDATADIR)/xattr1.txt
test_filemap_xattr_LDADD = libio.a libsquashfs.la libfstree.a libutil.a
-test_filemap_xattr_LDADD += libcompat.a
+test_filemap_xattr_LDADD += libcommon.a libcompat.a
test_fstree_from_file_SOURCES = bin/gensquashfs/test/fstree_from_file.c \
bin/gensquashfs/src/fstree_from_file.c \
diff --git a/bin/gensquashfs/src/filemap_xattr.c b/bin/gensquashfs/src/filemap_xattr.c
index 89624f4..8843c46 100644
--- a/bin/gensquashfs/src/filemap_xattr.c
+++ b/bin/gensquashfs/src/filemap_xattr.c
@@ -159,8 +159,12 @@ xattr_open_map_file(const char *path) {
struct XattrMap *map;
size_t line_num = 1;
char *p = NULL;
- sqfs_istream_t *file = istream_open_file(path);
- if (file == NULL) {
+ sqfs_istream_t *file = NULL;
+ int ret;
+
+ ret = istream_open_file(&file, path);
+ if (ret) {
+ sqfs_perror(path, NULL, ret);
return NULL;
}
diff --git a/bin/gensquashfs/src/fstree_from_file.c b/bin/gensquashfs/src/fstree_from_file.c
index efb5d43..f392b34 100644
--- a/bin/gensquashfs/src/fstree_from_file.c
+++ b/bin/gensquashfs/src/fstree_from_file.c
@@ -313,9 +313,11 @@ int fstree_from_file(fstree_t *fs, const char *filename, const char *basepath)
sqfs_istream_t *fp;
int ret;
- fp = istream_open_file(filename);
- if (fp == NULL)
+ ret = istream_open_file(&fp, filename);
+ if (ret) {
+ sqfs_perror(filename, NULL, ret);
return -1;
+ }
ret = fstree_from_file_stream(fs, fp, basepath);
diff --git a/bin/gensquashfs/src/mkfs.c b/bin/gensquashfs/src/mkfs.c
index cdef359..de291fa 100644
--- a/bin/gensquashfs/src/mkfs.c
+++ b/bin/gensquashfs/src/mkfs.c
@@ -160,9 +160,11 @@ int main(int argc, char **argv)
}
if (opt.sortfile != NULL) {
- sortfile = istream_open_file(opt.sortfile);
- if (sortfile == NULL)
+ int ret = istream_open_file(&sortfile, opt.sortfile);
+ if (ret) {
+ sqfs_perror(opt.sortfile, NULL, ret);
goto out;
+ }
}
if (opt.infile == NULL) {
diff --git a/bin/rdsquashfs/src/fill_files.c b/bin/rdsquashfs/src/fill_files.c
index e692ee3..f0ad7e2 100644
--- a/bin/rdsquashfs/src/fill_files.c
+++ b/bin/rdsquashfs/src/fill_files.c
@@ -145,9 +145,11 @@ static int fill_files(sqfs_data_reader_t *data, int flags)
openflags |= SQFS_FILE_OPEN_NO_SPARSE;
for (i = 0; i < num_files; ++i) {
- fp = ostream_open_file(files[i].path, openflags);
- if (fp == NULL)
+ ret = ostream_open_file(&fp, files[i].path, openflags);
+ if (ret) {
+ sqfs_perror(files[i].path, NULL, ret);
return -1;
+ }
if (!(flags & UNPACK_QUIET))
printf("unpacking %s\n", files[i].path);
@@ -157,9 +159,13 @@ static int fill_files(sqfs_data_reader_t *data, int flags)
if (ret == 0)
ret = fp->flush(fp);
- sqfs_drop(fp);
- if (ret)
+ if (ret) {
+ sqfs_perror(files[i].path, "unpacking", ret);
+ sqfs_drop(fp);
return -1;
+ }
+
+ sqfs_drop(fp);
}
return 0;
diff --git a/bin/rdsquashfs/src/rdsquashfs.c b/bin/rdsquashfs/src/rdsquashfs.c
index ad85e68..77dc5ba 100644
--- a/bin/rdsquashfs/src/rdsquashfs.c
+++ b/bin/rdsquashfs/src/rdsquashfs.c
@@ -208,6 +208,7 @@ int main(int argc, char **argv)
break;
case OP_CAT: {
sqfs_ostream_t *fp;
+ int ret;
if (!S_ISREG(n->inode->base.mode)) {
fprintf(stderr, "/%s: not a regular file\n",
@@ -215,9 +216,11 @@ int main(int argc, char **argv)
goto out;
}
- fp = ostream_open_stdout();
- if (fp == NULL)
+ ret = ostream_open_stdout(&fp);
+ if (ret) {
+ sqfs_perror("stdout", "creating stream wrapper", ret);
goto out;
+ }
ret = sqfs_data_reader_dump(opt.cmdpath, data, n->inode,
fp, super.block_size);
diff --git a/bin/sqfs2tar/src/sqfs2tar.c b/bin/sqfs2tar/src/sqfs2tar.c
index e90aa56..714f6db 100644
--- a/bin/sqfs2tar/src/sqfs2tar.c
+++ b/bin/sqfs2tar/src/sqfs2tar.c
@@ -117,9 +117,9 @@ int main(int argc, char **argv)
process_args(argc, argv);
- out_file = ostream_open_stdout();
- if (out_file == NULL) {
- perror("changing stdout to binary mode");
+ ret = ostream_open_stdout(&out_file);
+ if (ret) {
+ sqfs_perror("stdout", "creating stream wrapper", ret);
goto out;
}
@@ -253,8 +253,11 @@ int main(int argc, char **argv)
if (terminate_archive())
goto out;
- if (out_file->flush(out_file))
+ ret = out_file->flush(out_file);
+ if (ret) {
+ sqfs_perror(out_file->get_filename(out_file), NULL, ret);
goto out;
+ }
status = EXIT_SUCCESS;
out:
diff --git a/bin/sqfs2tar/src/write_tree.c b/bin/sqfs2tar/src/write_tree.c
index e578a9f..dc3ac72 100644
--- a/bin/sqfs2tar/src/write_tree.c
+++ b/bin/sqfs2tar/src/write_tree.c
@@ -119,6 +119,8 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
if (lnk != NULL) {
ret = write_hard_link(out_file, &sb, name, lnk->target,
record_counter++);
+ if (ret != 0)
+ sqfs_perror(name, "writing hard link", ret);
sqfs_free(name);
return ret;
}
@@ -143,10 +145,13 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
record_counter++);
sqfs_xattr_list_free(xattr);
- if (ret > 0)
+ if (ret == SQFS_ERROR_UNSUPPORTED) {
+ fprintf(stderr, "WARNING: %s: unsupported file type\n", name);
goto out_skip;
+ }
if (ret < 0) {
+ sqfs_perror(name, "writing tar header", ret);
sqfs_free(name);
return -1;
}
@@ -158,7 +163,9 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
return -1;
}
- if (padd_file(out_file, sb.st_size)) {
+ ret = padd_file(out_file, sb.st_size);
+ if (ret) {
+ sqfs_perror(name, NULL, ret);
sqfs_free(name);
return -1;
}
diff --git a/bin/sqfsdiff/src/extract.c b/bin/sqfsdiff/src/extract.c
index 43e9b97..d51096f 100644
--- a/bin/sqfsdiff/src/extract.c
+++ b/bin/sqfsdiff/src/extract.c
@@ -11,6 +11,7 @@ static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
{
char *ptr, *temp;
sqfs_ostream_t *fp;
+ int ret;
temp = alloca(strlen(prefix) + strlen(path) + 2);
sprintf(temp, "%s/%s", prefix, path);
@@ -21,9 +22,9 @@ static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
return -1;
*ptr = '/';
- fp = ostream_open_file(temp, SQFS_FILE_OPEN_OVERWRITE);
- if (fp == NULL) {
- perror(temp);
+ ret = ostream_open_file(&fp, temp, SQFS_FILE_OPEN_OVERWRITE);
+ if (ret) {
+ sqfs_perror(temp, NULL, ret);
return -1;
}
@@ -32,7 +33,13 @@ static int extract(sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode,
return -1;
}
- fp->flush(fp);
+ ret = fp->flush(fp);
+ if (ret) {
+ sqfs_perror(fp->get_filename(fp), NULL, ret);
+ sqfs_drop(fp);
+ return -1;
+ }
+
sqfs_drop(fp);
return 0;
}
diff --git a/bin/tar2sqfs/src/tar2sqfs.c b/bin/tar2sqfs/src/tar2sqfs.c
index f7ed060..ed671f5 100644
--- a/bin/tar2sqfs/src/tar2sqfs.c
+++ b/bin/tar2sqfs/src/tar2sqfs.c
@@ -12,12 +12,15 @@ int main(int argc, char **argv)
sqfs_istream_t *input_file = NULL;
dir_iterator_t *tar = NULL;
sqfs_writer_t sqfs;
+ int ret;
process_args(argc, argv);
- input_file = istream_open_stdin();
- if (input_file == NULL)
+ ret = istream_open_stdin(&input_file);
+ if (ret) {
+ sqfs_perror("stdint", "creating stream wrapper", ret);
return EXIT_FAILURE;
+ }
tar = tar_open_stream(input_file);
sqfs_drop(input_file);