1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

virt-aa-helper: fix rules for paths with trailing slash

Rules generated for a path like '/' were having '//' which isn't
correct for apparmor. Make virt-aa-helper smarter to avoid these.
This commit is contained in:
Cédric Bosdonnat 2015-06-24 09:56:04 +02:00
parent b7ea58c262
commit e44bcae9f0

View File

@ -795,6 +795,9 @@ vah_add_path(virBufferPtr buf, const char *path, const char *perms, bool recursi
goto cleanup;
}
if (tmp[strlen(tmp) - 1] == '/')
tmp[strlen(tmp) - 1] = '\0';
virBufferAsprintf(buf, " \"%s%s\" %s,\n", tmp, recursive ? "/**" : "", perms);
if (readonly) {
virBufferAddLit(buf, " # don't audit writes to readonly files\n");