From de22c28ef31d9721606ba05965a093a8044be0de Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Wed, 23 Jul 2014 13:47:35 +0800 Subject: btrfs-progs: Check fstype in find_mount_root() When calling find_mount_root(), caller in fact wants to find the mount point of *BTRFS*. So also check ent->fstype in find_mount_root() and do special error string output in caller. This will suppress a lot of "Inapproiate ioctl for device" error message. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- cmds-send.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cmds-send.c') diff --git a/cmds-send.c b/cmds-send.c index 9ec52dc..7141c07 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -355,6 +355,13 @@ static int init_root_path(struct btrfs_send *s, const char *subvol) ret = -EINVAL; goto out; } + if (ret > 0) { + fprintf(stderr, + "ERROR: %s doesn't belong to btrfs mount point\n", + subvol); + ret = -EINVAL; + goto out; + } s->mnt_fd = open(s->root_path, O_RDONLY | O_NOATIME); if (s->mnt_fd < 0) { @@ -587,6 +594,13 @@ int cmd_send(int argc, char **argv) strerror(-ret)); goto out; } + if (ret > 0) { + fprintf(stderr, + "ERROR: %s doesn't belong to btrfs mount point\n", + subvol); + ret = -EINVAL; + goto out; + } if (strcmp(send.root_path, mount_root) != 0) { ret = -EINVAL; fprintf(stderr, "ERROR: all subvols must be from the " -- cgit v1.2.1