aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-receive.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-16 15:28:44 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-16 17:15:02 +0200
commit8da9ecb08327d7ccb07fa17f09f1b9540931f8c2 (patch)
treec53c6eebfbfe3401957d60ea4b1e663ab05be0b7 /cmds-receive.c
parent36ac098aaea8026dd7fd5f48ffa97b444556a305 (diff)
downloadbtrfs-progs-8da9ecb08327d7ccb07fa17f09f1b9540931f8c2.tar.gz
btrfs-progs-8da9ecb08327d7ccb07fa17f09f1b9540931f8c2.tar.xz
btrfs-progs-8da9ecb08327d7ccb07fa17f09f1b9540931f8c2.zip
btrfs-progs: receive: use static buffer for write_path
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-receive.c')
-rw-r--r--cmds-receive.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/cmds-receive.c b/cmds-receive.c
index eaccc8c..a5c7f8d 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -56,7 +56,7 @@ struct btrfs_receive
int dest_dir_fd;
int write_fd;
- char *write_path;
+ char write_path[PATH_MAX];
char *root_path;
char *dest_dir_path; /* relative to root_path */
@@ -636,8 +636,7 @@ static int open_inode_for_write(struct btrfs_receive *r, const char *path)
strerror(-ret));
goto out;
}
- free(r->write_path);
- r->write_path = strdup(path);
+ strncpy_null(r->write_path, path);
out:
return ret;
@@ -1176,8 +1175,6 @@ out:
}
free(r->root_path);
r->root_path = NULL;
- free(r->write_path);
- r->write_path = NULL;
free(r->full_subvol_path);
r->full_subvol_path = NULL;
r->dest_dir_path = NULL;