diff options
author | Qu Wenruo <wqu@suse.com> | 2017-10-19 13:41:34 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-11-14 15:59:00 +0100 |
commit | a00bfc200ccfd27fe2f2bc1d0cd92b81a7bba06f (patch) | |
tree | e194f227a127478f692a90dfb6a4551ceeb7a336 | |
parent | 66e485873cf21e03cee5fe59b5dce807d2ac53ea (diff) |
btrfs-progs: mkfs: avoid positive return value from cleanup_temp_chunks
Since we're calling btrfs_search_slot() the return value can be
positive. However we just pass that return value out, causing undefined
return value.
This can cause mkfs to return 1, which indicates something wrong.
Fix it.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | mkfs/main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mkfs/main.c b/mkfs/main.c index 1b4cabc1..94f54d81 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1350,6 +1350,9 @@ static int cleanup_temp_chunks(struct btrfs_fs_info *fs_info, ret = btrfs_search_slot(trans, root, &key, &path, 0, 0); if (ret < 0) goto out; + /* Don't pollute ret for >0 case */ + if (ret > 0) + ret = 0; btrfs_item_key_to_cpu(path.nodes[0], &found_key, path.slots[0]); |