summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Burri <axel@tty0.ch>2018-05-15 17:22:14 +0200
committerDavid Sterba <dsterba@suse.com>2018-06-07 16:37:40 +0200
commit09827a8a332fdb1b74f4e103b8b72b0b800b5d72 (patch)
tree62e7c938dfaa7344c4a874abb9acc9c685a820e4
parentad6973647e421b2ae03deca3d55e73b3543796f4 (diff)
btrfs-progs: fix regression preventing send -p with subvolumes mounted on "/"
Fix subvol_strip_mountpoint for mnt="/" (len=1). In this case, skip check for trailing slash on full_path (leading slash on full_path is already asserted by strncmp). Issue: #122 Pull-request: #138 Fixes: c5dc299aff6b ("btrfs-progs: prevent incorrect use of subvol_strip_mountpoint") Signed-off-by: Axel Burri <axel@tty0.ch> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index d81d4980..21de09d3 100644
--- a/utils.c
+++ b/utils.c
@@ -2460,7 +2460,7 @@ const char *subvol_strip_mountpoint(const char *mnt, const char *full_path)
if (!len)
return full_path;
- if ((strncmp(mnt, full_path, len) != 0) || (full_path[len] != '/')) {
+ if ((strncmp(mnt, full_path, len) != 0) || ((len > 1) && (full_path[len] != '/'))) {
error("not on mount point: %s", mnt);
exit(1);
}