
On Tue, Apr 05, 2016 at 03:08:41PM +0200, Andrea Bolognani wrote:
The existing code was built with the assumption that no cgroup name could appear as part of another cgroup name.
This is not true - the code checked if there is a comma or a null character after the cgroup name.
Rewrite it to handle such cases correctly. --- tools/virt-host-validate-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index 56c6b56..d448e5c 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -340,16 +340,24 @@ static int virHostValidateCGroupMount(const char *hvname, goto error;
while (getmntent_r(fp, &ent, mntbuf, sizeof(mntbuf)) && !matched) { - char *tmp = strstr(ent.mnt_opts, cg_name); - if (!tmp) + char **opts; + size_t nopts; + size_t i; +
+ /* Ignore non-cgroup mounts */ + if (STRNEQ(ent.mnt_type, "cgroup")) continue;
This hunk makes sense, but I think it is unlikely to have a mount option matching a cgroup name on a non-cgroup mount. ACK to this hunk. The conversion to virStringSplit is IMO not worth it. Jan