if (ret < 0)
goto out;
- BUG_ON(r->cur_subvol.path);
- BUG_ON(r->cur_subvol_path[0]);
+ if (r->cur_subvol.path) {
+ error("subvol: another one already started, path ptr: %s",
+ r->cur_subvol.path);
+ ret = -EINVAL;
+ goto out;
+ }
+ if (r->cur_subvol_path[0]) {
+ error("subvol: another one already started, path buf: %s",
+ r->cur_subvol.path);
+ ret = -EINVAL;
+ goto out;
+ }
if (*r->dest_dir_path == 0) {
strncpy_null(r->cur_subvol_path, path);
if (ret < 0)
goto out;
- BUG_ON(r->cur_subvol.path);
- BUG_ON(r->cur_subvol_path[0]);
+ if (r->cur_subvol.path) {
+ error("snapshot: another one already started, path ptr: %s",
+ r->cur_subvol.path);
+ ret = -EINVAL;
+ goto out;
+ }
+ if (r->cur_subvol_path[0]) {
+ error("snapshot: another one already started, path buf: %s",
+ r->cur_subvol.path);
+ ret = -EINVAL;
+ goto out;
+ }
if (*r->dest_dir_path == 0) {
strncpy_null(r->cur_subvol_path, path);
r->write_fd = open(path, O_RDWR);
if (r->write_fd < 0) {
ret = -errno;
- error("cannont open %s: %s", path, strerror(-ret));
+ error("cannot open %s: %s", path, strerror(-ret));
goto out;
}
strncpy_null(r->write_path, path);
char *dest_dir_full_path;
char root_subvol_path[PATH_MAX];
int end = 0;
+ int count;
dest_dir_full_path = realpath(tomnt, NULL);
if (!dest_dir_full_path) {
* subvols we want to receive in.
*/
ret = btrfs_list_get_path_rootid(r->mnt_fd, &subvol_id);
- if (ret) {
- error("cannot resolve our subvolid: %d",
- ret);
+ if (ret)
goto out;
- }
root_subvol_path[0] = 0;
ret = btrfs_subvolid_resolve(r->mnt_fd, root_subvol_path,
if (ret < 0)
goto out;
+ count = 0;
while (!end) {
if (r->cached_capabilities_len) {
if (g_verbose >= 3)
max_errors);
if (ret < 0)
goto out;
+ /* Empty stream is invalid */
+ if (ret && count == 0) {
+ error("empty stream is not considered valid");
+ ret = -EINVAL;
+ goto out;
+ }
+ count++;
if (ret)
end = 1;