summaryrefslogtreecommitdiff
path: root/cmds-receive.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmds-receive.c')
-rw-r--r--cmds-receive.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmds-receive.c b/cmds-receive.c
index 97952763..90e26d25 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -66,6 +66,8 @@ struct btrfs_receive
struct subvol_info *cur_subvol;
struct subvol_uuid_search sus;
+
+ int honor_end_cmd;
};
static int finish_subvol(struct btrfs_receive *r)
@@ -810,7 +812,8 @@ int do_receive(struct btrfs_receive *r, const char *tomnt, int r_fd)
goto out;
while (!end) {
- ret = btrfs_read_and_process_send_stream(r_fd, &send_ops, r);
+ ret = btrfs_read_and_process_send_stream(r_fd, &send_ops, r,
+ r->honor_end_cmd);
if (ret < 0)
goto out;
if (ret)
@@ -863,7 +866,7 @@ static int do_cmd_receive(int argc, char **argv)
r.mnt_fd = -1;
r.write_fd = -1;
- while ((c = getopt(argc, argv, "vf:")) != -1) {
+ while ((c = getopt(argc, argv, "evf:")) != -1) {
switch (c) {
case 'v':
g_verbose++;
@@ -871,6 +874,9 @@ static int do_cmd_receive(int argc, char **argv)
case 'f':
fromfile = optarg;
break;
+ case 'e':
+ r.honor_end_cmd = 1;
+ break;
case '?':
default:
fprintf(stderr, "ERROR: receive args invalid.\n");
@@ -904,7 +910,7 @@ static const char * const receive_cmd_group_usage[] = {
};
const char * const cmd_receive_usage[] = {
- "btrfs receive [-v] [-f <infile>] <mount>",
+ "btrfs receive [-ve] [-f <infile>] <mount>",
"Receive subvolumes from stdin.",
"Receives one or more subvolumes that were previously ",
"sent with btrfs send. The received subvolumes are stored",
@@ -920,6 +926,10 @@ const char * const cmd_receive_usage[] = {
"-f <infile> By default, btrfs receive uses stdin",
" to receive the subvolumes. Use this",
" option to specify a file to use instead.",
+ "-e Terminate after receiving an <end cmd>",
+ " in the data stream. Without this option,",
+ " the receiver terminates only if an error",
+ " is recognized or on EOF.",
NULL
};