On 10.12.2014 14:49, Cédric Bosdonnat wrote:
When calling virCgroupAllowAllDevices we get these invalid entries
in the device cgroup config.
b -1:-1 rw
c -1:-1 rw
Check for positive values before outputting the major and minor to
avoid that.
---
src/util/vircgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 166f4dc..3995477 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2767,11 +2767,11 @@ virCgroupAllowDevice(virCgroupPtr group, char type, int major,
int minor,
char *minorstr = NULL;
if ((major < 0 && VIR_STRDUP(majorstr, "*") < 0) ||
- virAsprintf(&majorstr, "%i", major) < 0)
+ (major >= 0 && virAsprintf(&majorstr, "%i", major) <
0))
goto cleanup;
if ((minor < 0 && VIR_STRDUP(minorstr, "*") < 0) ||
- virAsprintf(&minorstr, "%i", minor) < 0)
+ (minor >= 0 && virAsprintf(&minorstr, "%i", minor) <
0))
goto cleanup;
if (virAsprintf(&devstr, "%c %s:%s %s", type, majorstr, minorstr,
ACK, nice catch. Safe to push during freeze.
Michal