<div dir="auto">This is stranger. Even this mail of yours is not showing up in mail archives. Let me resend the patch<div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">-Pratik</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 24 Jul, 2019, 7:04 AM Gao Xiang, <<a href="mailto:gaoxiang25@huawei.com">gaoxiang25@huawei.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Pratik,<br>
<br>
This patch isn't in erofs mailing list. I don't know what is wrong...<br>
Could you resend the patch? It'd be better in the mailing list....<br>
<br>
On 2019/7/24 4:04, Pratik Shinde wrote:<br>
> Handling error conditions that are missing in few scenarios.<br>
> <br>
> Signed-off-by: Pratik Shinde <<a href="mailto:pratikshinde320@gmail.com" target="_blank" rel="noreferrer">pratikshinde320@gmail.com</a>><br>
> ---<br>
> lib/inode.c | 10 ++++++++--<br>
> mkfs/main.c | 10 ++++++++--<br>
> 2 files changed, 16 insertions(+), 4 deletions(-)<br>
> <br>
> diff --git a/lib/inode.c b/lib/inode.c<br>
> index 179aa26..08d38c0 100644<br>
> --- a/lib/inode.c<br>
> +++ b/lib/inode.c<br>
> @@ -752,8 +752,14 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir)<br>
> }<br>
> closedir(_dir);<br>
> <br>
> - erofs_prepare_dir_file(dir);<br>
> - erofs_prepare_inode_buffer(dir);<br>
> + ret = erofs_prepare_dir_file(dir);<br>
> + if(!ret)<br>
> + goto err_closedir;<br>
> +<br>
> + ret = erofs_prepare_inode_buffer(dir);<br>
> + if(!ret)<br>
> + goto err_closedir;<br>
> +<br>
> if (IS_ROOT(dir))<br>
> erofs_fixup_meta_blkaddr(dir);<br>
> <br>
> diff --git a/mkfs/main.c b/mkfs/main.c<br>
> index 1348587..9c9530d 100644<br>
> --- a/mkfs/main.c<br>
> +++ b/mkfs/main.c<br>
> @@ -200,18 +200,24 @@ int main(int argc, char **argv)<br>
> if (err) {<br>
> if (err == -EINVAL)<br>
> usage();<br>
> - return 1;<br>
> + return err;<br>
<br>
current erofs-utils will return 1; when failure...<br>
If you suggest to return the real error code, could you fix the following as well?<br>
and it should be return -err; since a positive error code is perfered? I have no idea....<br>
<br>
253 exit:<br>
254 z_erofs_compress_exit();<br>
255 dev_close();<br>
256 erofs_exit_configure();<br>
257<br>
258 if (err) {<br>
259 erofs_err("\tCould not format the device : %s\n",<br>
260 erofs_strerror(err));<br>
261 return 1;<br>
262 }<br>
263 return err;<br>
<br>
Thanks,<br>
Gao Xiang<br>
<br>
> }<br>
> <br>
> err = dev_open(cfg.c_img_path);<br>
> if (err) {<br>
> usage();<br>
> - return 1;<br>
> + return err;<br>
> }<br>
> <br>
> erofs_show_config();<br>
> <br>
> sb_bh = erofs_buffer_init();<br>
> + if(IS_ERR(sb_bh)) {<br>
> + err = PTR_ERR(sb_bh);<br>
> + erofs_err("Failed to initialize super block buffer head : %s",<br>
> + erofs_strerror(err));<br>
> + goto exit;<br>
> + }<br>
> err = erofs_bh_balloon(sb_bh, EROFS_SUPER_END);<br>
> if (err < 0) {<br>
> erofs_err("Failed to balloon erofs_super_block: %s",<br>
> <br>
</blockquote></div>