erofs-utils: Add missing error code handling.
PATCH v3 1/1 erofs-utils: Add missing error code handling.
Handling error conditions that are missed in few scenarios. also, mkfs command should return 1 on failure and 0 on success.
Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>
--- lib/inode.c | 10 ++++++++-- mkfs/main.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-)
lib/inode.c +8 -2
@@ -752,8 +752,14 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir) }closedir (_dir); -erofs_prepare_dir_file (dir); -erofs_prepare_inode_buffer (dir); + ret =erofs_prepare_dir_file (dir); +if (ret) + goto err_closedir; + + ret =erofs_prepare_inode_buffer (dir); +if (ret) + goto err_closedir; +if (IS_ROOT (dir))erofs_fixup_meta_blkaddr (dir);
mkfs/main.c +7 -1
@@ -212,6 +212,12 @@ int main(int argc, char **argv)erofs_show_config (); sb_bh =erofs_buffer_init (); +if (IS_ERR (sb_bh)) { + err =PTR_ERR (sb_bh); +erofs_err ("Failed to initialize buffers: %s" , +erofs_strerror (err)); + goto exit; + } err =erofs_bh_balloon (sb_bh,EROFS_SUPER_END );if (err <0 ) { erofs_err("Failed to balloon erofs_super_block: %s",
@@ -254,5 +260,5 @@ exit: erofs_strerror(err));return 1 ; } -return err; +return 0 ; }
Signature · 1 line
2.9.3
PATCH v3 1/1 erofs-utils: Add missing error code handling.
Quoted 4 lines · Pratik Shinde
Handling error conditions that are missed in few scenarios. also, mkfs command should return 1 on failure and 0 on success.
Signed-off-by Pratik Shinde <pratikshinde320 at gmail.com>
looks good to me, will apply later....
(since Li Guifu cannot send outgoing email...I will apply directly.)
Thanks,
Gao Xiang