btrfs-progs: receive: set up max_errors count

The command

 $ printf 'btrfs-stream\0\0\0\0\0' | btrfs receive --dump

can loop as the stream is not valid, but the maximum error limit is not
set properly for --dump. The command line parameter -E applies here too,
so it's still possible to dump partially damanged stream.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200085
Author: Alexander Kovtunenko <akovtunenko@slice.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Alexander Kovtunenko 2018-10-15 16:02:11 +03:00 committed by David Sterba
parent f2d5990d31
commit 53e8014369
1 changed files with 1 additions and 1 deletions

View File

@ -1347,7 +1347,7 @@ int cmd_receive(int argc, char **argv)
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);
&btrfs_print_send_ops, &dump_args, 0, max_errors);
if (ret < 0) {
errno = -ret;
error("failed to dump the send stream: %m");