diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-05 23:18:30 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-10-05 23:18:30 +0200 |
commit | 6261ef9505abb26d79cc48f24bce0d4de8419a45 (patch) | |
tree | 33069695fd0723e10ff5c0e7eb1748d709de5e3d /mkfs/mkfs.c | |
parent | 40b75c24b1586e4d7ad8a9f4c14dc0b3ff99b8cd (diff) |
Improve error reporting for tar2sqfs and gensquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs/mkfs.c')
-rw-r--r-- | mkfs/mkfs.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c index 16f9bc0..b000652 100644 --- a/mkfs/mkfs.c +++ b/mkfs/mkfs.c @@ -73,7 +73,8 @@ static int pack_files(sqfs_data_writer_t *data, fstree_t *fs, fi->user_ptr = inode; - ret = write_data_from_file(data, inode, file, 0); + ret = write_data_from_file(fi->input_file, data, + inode, file, 0); file->destroy(file); if (ret) @@ -86,18 +87,20 @@ static int pack_files(sqfs_data_writer_t *data, fstree_t *fs, return restore_working_dir(opt); } -static int relabel_tree_dfs(sqfs_xattr_writer_t *xwr, tree_node_t *n, - void *selinux_handle) +static int relabel_tree_dfs(const char *filename, sqfs_xattr_writer_t *xwr, + tree_node_t *n, void *selinux_handle) { char *path = fstree_get_path(n); + int ret; if (path == NULL) { perror("getting absolute node path for SELinux relabeling"); return -1; } - if (sqfs_xattr_writer_begin(xwr)) { - fputs("error recoding xattr key-value pairs\n", stderr); + ret = sqfs_xattr_writer_begin(xwr); + if (ret) { + sqfs_perror(filename, "recording xattr key-value pairs", ret); return -1; } @@ -106,8 +109,10 @@ static int relabel_tree_dfs(sqfs_xattr_writer_t *xwr, tree_node_t *n, return -1; } - if (sqfs_xattr_writer_end(xwr, &n->xattr_idx)) { - fputs("error generating xattr index\n", stderr); + ret = sqfs_xattr_writer_end(xwr, &n->xattr_idx); + if (ret) { + sqfs_perror(filename, "flushing completed key-value pairs", + ret); return -1; } @@ -115,7 +120,7 @@ static int relabel_tree_dfs(sqfs_xattr_writer_t *xwr, tree_node_t *n, if (S_ISDIR(n->mode)) { for (n = n->data.dir.children; n != NULL; n = n->next) { - if (relabel_tree_dfs(xwr, n, selinux_handle)) + if (relabel_tree_dfs(filename, xwr, n, selinux_handle)) return -1; } } @@ -144,7 +149,8 @@ static int read_fstree(fstree_t *fs, options_t *opt, sqfs_xattr_writer_t *xwr, fclose(fp); if (ret == 0 && selinux_handle != NULL) - ret = relabel_tree_dfs(xwr, fs->root, selinux_handle); + ret = relabel_tree_dfs(opt->cfg.filename, xwr, + fs->root, selinux_handle); return ret; } |