linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@kernel.org>
To: David Disseldorp <ddiss@suse.de>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>,
	Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH 1/3] Btrfs-progs: fix mount point detection due to partial prefix match
Date: Mon, 14 Jan 2019 14:12:30 +0000	[thread overview]
Message-ID: <CAL3q7H7_cORSt+hY2mTP0Kx+pqaUoiYKfFs=puq9mwbKA7Wgew@mail.gmail.com> (raw)
In-Reply-To: <20190114145944.609d56b6@suse.de>

On Mon, Jan 14, 2019 at 1:59 PM David Disseldorp <ddiss@suse.de> wrote:
>
> On Mon, 14 Jan 2019 13:30:24 +0000, fdmanana@kernel.org wrote:
>
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > When attempting to find the mount point of a path we can end up returning
> > an incorrect mount point. This happens because we consider a mount point
> > valid for the given path even if it matches only partially the patch.
>
> s/patch/path/? "...even if it only partially matches" might be a bit
> clearer.

Agreed.
David can probably correct that (and your email address from ddis@ to
ddiss@) when he picks the patch, otherwise I can send a new version.
Thanks.

>
> > diff --git a/utils.c b/utils.c
> > index 3a4bc92a..6616630b 100644
> > --- a/utils.c
> > +++ b/utils.c
> > @@ -2064,7 +2064,8 @@ int find_mount_root(const char *path, char **mount_root)
> >
> >       while ((ent = getmntent(mnttab))) {
> >               len = strlen(ent->mnt_dir);
> > -             if (strncmp(ent->mnt_dir, path, len) == 0) {
> > +             if (strncmp(ent->mnt_dir, path, len) == 0 &&
> > +                 (path[len] == '/' || path[len] == '\0')) {
>
> Looks good and works for me.
> Reviewed-by: David Disseldorp <ddiss@suse.de>

      reply	other threads:[~2019-01-14 14:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 13:30 [PATCH 1/3] Btrfs-progs: fix mount point detection due to partial prefix match fdmanana
2019-01-14 13:59 ` David Disseldorp
2019-01-14 14:12   ` Filipe Manana [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL3q7H7_cORSt+hY2mTP0Kx+pqaUoiYKfFs=puq9mwbKA7Wgew@mail.gmail.com' \
    --to=fdmanana@kernel.org \
    --cc=ddiss@suse.de \
    --cc=fdmanana@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).