summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorPratik Shinde <pratikshinde320@gmail.com>2019-07-24 14:42:46 +0530
committerGao Xiang <hsiangkao@aol.com>2019-08-03 11:27:42 +0800
commit1ab9a08fa23163f361922c3aa94cb4a6918ce080 (patch)
tree557bc45277acdc52f5caeded3c5546cdb2e0f805 /mkfs
parent1f11cf0463b503e86af3e07a84feafe05c0b10d7 (diff)
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@gmail.com>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mkfs/main.c b/mkfs/main.c
index 1348587..fdb65fd 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -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;
}