On Wed, Sep 07, 2016 at 08:29:34AM +0800, Qu Wenruo wrote:
> @@ -1265,19 +1274,37 @@ int cmd_receive(int argc, char **argv)
> }
> }
>
> - ret = do_receive(&r, tomnt, realmnt, receive_fd, max_errors);
> + if (dump) {
> + struct btrfs_dump_send_args dump_args;
> +
> + dump_args.root_path = malloc(PATH_MAX);
> + dump_args.root_path[0] = '.';
> + dump_args.root_path[1] = '\0';
> + dump_args.full_subvol_path = malloc(PATH_MAX);
Please always check malloc return values. I'm fixing this for now.
> + dump_args.full_subvol_path[0] = '.';
> + dump_args.full_subvol_path[1] = '\0';
> + ret = btrfs_read_and_process_send_stream(receive_fd,
> + &btrfs_print_send_ops, &dump_args, 0, 0);
> + if (ret < 0)
> + error("failed to dump the send stream: %s",
> + strerror(-ret));
> + } else {
> + ret = do_receive(&r, tomnt, realmnt, receive_fd, max_errors);
> + }
> +
> if (receive_fd != fileno(stdin))
> close(receive_fd);
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html