[systemd-devel] [PATCH] path: follow symbolic link for parent path

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Dec 17 16:32:55 PST 2014


On Wed, Dec 17, 2014 at 10:48:55AM +0100, Umut Tezduyar Lindskog wrote:
> On Wed, Dec 17, 2014 at 10:21 AM, "Jóhann B. Guðmundsson"
> <johannbg at gmail.com> wrote:
> >
> > On 12/17/2014 02:20 AM, Zbigniew Jędrzejewski-Szmek wrote:
> >>
> >> On Tue, Dec 16, 2014 at 09:58:39PM +0100, Umut Tezduyar Lindskog wrote:
> >>>
> >>> ---
> >>>   src/shared/path-util.c | 2 +-
> >>>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/src/shared/path-util.c b/src/shared/path-util.c
> >>> index dcc8321..304281f 100644
> >>> --- a/src/shared/path-util.c
> >>> +++ b/src/shared/path-util.c
> >>> @@ -518,7 +518,7 @@ fallback:
> >>>           if (r < 0)
> >>>                   return r;
> >>>   -        r = lstat(parent, &b);
> >>> +        r = stat(parent, &b);
> >>>           if (r < 0)
> >>>                   return -errno;
> >>
> >> Applied.
> >
> >
> > Was this not being done by design as in there was an deliberate intent not
> > to follow symbolic link for parent path?
> If you are not following the symbolic link, you might report falsely
> that given path is a mount point.
IIUC: let's say that /var/log is a link to /shared/log, and we are asking if
/var/log/journal is a mount point. We want to compare the the file handles
of /shared/log/journal with /shared/log. We should always follow symlinks
above the last component in the path (like lstat()).

Zbyszek


More information about the systemd-devel mailing list