diff options
author | David Sterba <dsterba@suse.com> | 2016-09-06 13:08:29 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-09-21 14:12:38 +0200 |
commit | 28fdd0d2ae35f02f78b29da2d119b673c7855c37 (patch) | |
tree | 6dd78368149222498ab2cd03a4347ff8e6ba1877 /cmds-receive.c | |
parent | 1ef93ea8632b89598d7723a04a2d268b70333168 (diff) |
btrfs-progs: receive: improved error handling in process_snapshot
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-receive.c')
-rw-r--r-- | cmds-receive.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cmds-receive.c b/cmds-receive.c index f4a3a4f1..d0525bfb 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -166,8 +166,18 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid, if (ret < 0) goto out; - BUG_ON(r->cur_subvol.path); - BUG_ON(r->cur_subvol_path[0]); + if (r->cur_subvol.path) { + error("subvol: another one already started, path ptr: %s", + r->cur_subvol.path); + ret = -EINVAL; + goto out; + } + if (r->cur_subvol_path[0]) { + error("subvol: another one already started, path buf: %s", + r->cur_subvol.path); + ret = -EINVAL; + goto out; + } if (*r->dest_dir_path == 0) { strncpy_null(r->cur_subvol_path, path); @@ -224,8 +234,18 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid, if (ret < 0) goto out; - BUG_ON(r->cur_subvol.path); - BUG_ON(r->cur_subvol_path[0]); + if (r->cur_subvol.path) { + error("snapshot: another one already started, path ptr: %s", + r->cur_subvol.path); + ret = -EINVAL; + goto out; + } + if (r->cur_subvol_path[0]) { + error("snapshot: another one already started, path buf: %s", + r->cur_subvol.path); + ret = -EINVAL; + goto out; + } if (*r->dest_dir_path == 0) { strncpy_null(r->cur_subvol_path, path); |