Commit a8853344994a7c6aaca882a5e949ab5536821ab5 added this
function and wrapped vah_add_file in it. vah_add_file may
return -1, 0, 1. It returns 1 in case the call to valid_path
detects a restricted file. The original code treated a return
value != 0 as error. The refactored code treats a return
value < 0 as error. This triggers segfault in virt-aa-helper
and breaks virt-aa-helper-test for the restricted file tests.
Make sure that add_file_path returns -1 on error.
---
src/security/virt-aa-helper.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 16b1920..da7d515 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -818,6 +818,9 @@ add_file_path(virDomainDiskDefPtr disk,
ret = vah_add_file(buf, path, "r");
}
+ if (ret != 0)
+ ret = -1;
+
return ret;
}
--
1.7.0.4