diff options
-rw-r--r-- | btrfs-corrupt-block.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/btrfs-corrupt-block.c b/btrfs-corrupt-block.c index 6c587504..b2ec5dea 100644 --- a/btrfs-corrupt-block.c +++ b/btrfs-corrupt-block.c @@ -1337,9 +1337,15 @@ int main(int argc, char **argv) goto out_close; } if (corrupt_item) { + struct btrfs_root *target; if (!key.objectid) print_usage(1); - ret = corrupt_btrfs_item(root, &key, field); + if (!root_objectid) + print_usage(1); + + target = open_root(root->fs_info, root_objectid); + + ret = corrupt_btrfs_item(target, &key, field); } if (delete) { struct btrfs_root *target = root; |