aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-image.c
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2014-06-26 10:53:04 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:43:11 +0200
commitcc1c1eab1792db37593d4c840bfaef1e6af831d7 (patch)
treea17bafd679909b4d3b21866fce031fd058c12485 /btrfs-image.c
parentaada0509618c3e358e1b2eb164647f0b9a12c646 (diff)
downloadbtrfs-progs-cc1c1eab1792db37593d4c840bfaef1e6af831d7.tar.gz
btrfs-progs-cc1c1eab1792db37593d4c840bfaef1e6af831d7.tar.xz
btrfs-progs-cc1c1eab1792db37593d4c840bfaef1e6af831d7.zip
btrfs-progs: cleanup possible silent failure in btrfs-image
If the malloc above fails, the btrfs-image will exit directly without any error messages. Now just return the ENOMEM errno and let the caller prompt the error message. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'btrfs-image.c')
-rw-r--r--btrfs-image.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 1a460ba..b8e8c4d 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2421,7 +2421,8 @@ static int update_disk_super_on_device(struct btrfs_fs_info *info,
buf = malloc(BTRFS_SUPER_INFO_SIZE);
if (!buf) {
ret = -ENOMEM;
- exit(1);
+ close(fp);
+ return ret;
}
memcpy(buf, info->super_copy, BTRFS_SUPER_INFO_SIZE);