aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-receive.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-16 15:36:42 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-16 17:15:02 +0200
commit34e2149488dd746b9cc8376ae04c509b3516a94d (patch)
tree110f3034371497a18b8832c396d7ee84add13b57 /cmds-receive.c
parent8da9ecb08327d7ccb07fa17f09f1b9540931f8c2 (diff)
downloadbtrfs-progs-34e2149488dd746b9cc8376ae04c509b3516a94d.tar.gz
btrfs-progs-34e2149488dd746b9cc8376ae04c509b3516a94d.tar.xz
btrfs-progs-34e2149488dd746b9cc8376ae04c509b3516a94d.zip
btrfs-progs: send utils: switch callbacks to patch_cat3_out
Also switch full_subvol_path to a static buffer as the interface semantics change. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-receive.c')
-rw-r--r--cmds-receive.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/cmds-receive.c b/cmds-receive.c
index a5c7f8d..46e1476 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -60,7 +60,7 @@ struct btrfs_receive
char *root_path;
char *dest_dir_path; /* relative to root_path */
- char *full_subvol_path;
+ char full_subvol_path[PATH_MAX];
char *full_root_path;
int dest_dir_chroot;
@@ -166,8 +166,12 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
r->cur_subvol.path = strdup(path);
else
r->cur_subvol.path = path_cat(r->dest_dir_path, path);
- free(r->full_subvol_path);
- r->full_subvol_path = path_cat3(r->root_path, r->dest_dir_path, path);
+ ret = path_cat3_out(r->full_subvol_path, r->root_path,
+ r->dest_dir_path, path);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: subvol: path invalid: %s\n", path);
+ goto out;
+ }
fprintf(stderr, "At subvol %s\n", path);
@@ -215,8 +219,12 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
r->cur_subvol.path = strdup(path);
else
r->cur_subvol.path = path_cat(r->dest_dir_path, path);
- free(r->full_subvol_path);
- r->full_subvol_path = path_cat3(r->root_path, r->dest_dir_path, path);
+ ret = path_cat3_out(r->full_subvol_path, r->root_path,
+ r->dest_dir_path, path);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: snapshot: path invalid: %s\n", path);
+ goto out;
+ }
fprintf(stdout, "At snapshot %s\n", path);
@@ -1175,8 +1183,6 @@ out:
}
free(r->root_path);
r->root_path = NULL;
- free(r->full_subvol_path);
- r->full_subvol_path = NULL;
r->dest_dir_path = NULL;
free(dest_dir_full_path);
if (r->cur_subvol.path) {