projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
btrfs-progs: check/lowmem mode: Check inline extent size
[platform/upstream/btrfs-progs.git]
/
cmds-receive.c
diff --git
a/cmds-receive.c
b/cmds-receive.c
index
b59f00e
..
68123a3
100644
(file)
--- a/
cmds-receive.c
+++ b/
cmds-receive.c
@@
-1091,6
+1091,7
@@
static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
char *dest_dir_full_path;
char root_subvol_path[PATH_MAX];
int end = 0;
char *dest_dir_full_path;
char root_subvol_path[PATH_MAX];
int end = 0;
+ int iterations = 0;
dest_dir_full_path = realpath(tomnt, NULL);
if (!dest_dir_full_path) {
dest_dir_full_path = realpath(tomnt, NULL);
if (!dest_dir_full_path) {
@@
-1198,13
+1199,18
@@
static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
rctx,
rctx->honor_end_cmd,
max_errors);
rctx,
rctx->honor_end_cmd,
max_errors);
- if (ret < 0 && ret == -ENODATA) {
+ if (ret < 0) {
+ if (ret != -ENODATA)
+ goto out;
+
/* Empty stream is invalid */
/* Empty stream is invalid */
- error("empty stream is not considered valid");
- ret = -EINVAL;
- goto out;
- } else if (ret < 0) {
- goto out;
+ if (iterations == 0) {
+ error("empty stream is not considered valid");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ret = 1;
}
if (ret > 0)
end = 1;
}
if (ret > 0)
end = 1;
@@
-1213,6
+1219,8
@@
static int do_receive(struct btrfs_receive *rctx, const char *tomnt,
ret = finish_subvol(rctx);
if (ret < 0)
goto out;
ret = finish_subvol(rctx);
if (ret < 0)
goto out;
+
+ iterations++;
}
ret = 0;
}
ret = 0;
@@
-1269,7
+1277,7
@@
int cmd_receive(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
{ NULL, 0, NULL, 0 }
};
- c = getopt_long(argc, argv, "Cevf:m:", long_opts, NULL);
+ c = getopt_long(argc, argv, "Cevf:m:
E:
", long_opts, NULL);
if (c < 0)
break;
if (c < 0)
break;
@@
-1322,7
+1330,7
@@
int cmd_receive(int argc, char **argv)
if (fromfile[0]) {
receive_fd = open(fromfile, O_RDONLY | O_NOATIME);
if (receive_fd < 0) {
if (fromfile[0]) {
receive_fd = open(fromfile, O_RDONLY | O_NOATIME);
if (receive_fd < 0) {
- error("cannot open %s: %
s", fromfile, strerror(errno)
);
+ error("cannot open %s: %
m", fromfile
);
goto out;
}
}
goto out;
}
}