summaryrefslogtreecommitdiff
path: root/cmds-send.c
diff options
context:
space:
mode:
authorAlex Lyakas <alex.btrfs@zadarastorage.com>2013-04-09 19:08:45 +0200
committerDavid Sterba <dsterba@suse.cz>2013-04-23 18:56:25 +0200
commit6712828275631b6b627ce97be042c93f4a4aa6c5 (patch)
treeced693b0345cab35074b0a03b528bb540a8ffc93 /cmds-send.c
parent913372adbd2049b948f2930515ecc131b100c6ea (diff)
downloadbtrfs-progs-6712828275631b6b627ce97be042c93f4a4aa6c5.tar.gz
btrfs-progs: Fix the receive code pathing
The receive code was not distinguishing properly between the mount root and the directory to create the received subvolume in. Also make sure the find_mount_root reports an error if it cannot find a match at all. Reported-by: Robert Buhren <robert@robertbuhren.de> Reported-by: Rory Campbell-Lange <rory@campbell-lange.net> Reported-by: Stefan Priebe - Profihost AG <s.priebe@profihost.ag> Signed-off-by: Alex Lyakas <alex.btrfs@zadarastorage.com> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Diffstat (limited to 'cmds-send.c')
-rw-r--r--cmds-send.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmds-send.c b/cmds-send.c
index fcde74c..9bb4206 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -84,6 +84,13 @@ int find_mount_root(const char *path, char **mount_root)
}
fclose(mnttab);
+ if (!longest_match) {
+ fprintf(stderr,
+ "ERROR: Failed to find mount root for path %s.\n",
+ path);
+ return -ENOENT;
+ }
+
*mount_root = realpath(longest_match, NULL);
free(longest_match);