On Thu, May 02, 2024 at 19:39:41 +0200, Andrea Bolognani wrote: > If the local admin has explicitly declared that a certain > filesystem is to be considered shared, we should treat it as > such. > > Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> > Reviewed-by: Stefan Berger <stefanb@xxxxxxxxxxxxx> > --- > src/util/virfile.c | 42 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > > diff --git a/src/util/virfile.c b/src/util/virfile.c > index 3268866f8b..45815919d6 100644 > --- a/src/util/virfile.c > +++ b/src/util/virfile.c > @@ -3801,9 +3801,49 @@ virFileGetDefaultHugepage(virHugeTLBFS *fs, > return NULL; > } > > +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. 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; 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). _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx