Re: [PATCH v3 4/5] utils: Use overrides in virFileIsSharedFS()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 09, 2024 at 02:28:15PM GMT, Peter Krempa wrote:
> On Thu, May 02, 2024 at 19:39:41 +0200, Andrea Bolognani wrote:
> > +static bool
> > +virFileIsSharedFSOverride(const char *path,
> > +                          char *const *overrides)
> > +{
> > +    g_autofree char *dirpath = NULL;
> > +    char *p = NULL;
> > +
> > +    if (!path || path[0] != '/' || !overrides)
> > +        return false;
>
> Per my comment on canonicalizing paths only when they're about to be
> used.

Gotcha.

> I think you can also modify the algorithm to avoid the truncate&compare
> operations to:
>
>
> foreach override in overrides:
>
>   pc = canonicalize(path);
>   po = canonicalize(override);
>
>   if (STRPREFIX(pc, po))
>     return true;

I'll give it a try.

> Checking the full prefix on canonicalized paths is IIUC equivalent to
> what you do below. (Okay perhaps except the case when user declares a
> full to a single file as an exported override).

That isn't supposed to work anyway... If the current code allows it
then it will need to be fixed.

-- 
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux