[libvirt] [PATCH 1/3] virt-aa-helper: Use virCommand APIs directly

Andrea Bolognani posted 3 patches 6 years, 5 months ago
[libvirt] [PATCH 1/3] virt-aa-helper: Use virCommand APIs directly
Posted by Andrea Bolognani 6 years, 5 months ago
Right now we're using the virRun() convenience API, but that
doesn't allow the kind of control we want. Use the virCommand
APIs directly instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/security/virt-aa-helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index ad9a7dda94..c5080f698a 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -170,7 +170,9 @@ parserCommand(const char *profile_name, const char cmd)
         const char * const argv[] = {
             "/sbin/apparmor_parser", flag, profile, NULL
         };
-        if ((ret = virRun(argv, &status)) != 0 ||
+        VIR_AUTOPTR(virCommand) command = virCommandNewArgs(argv);
+
+        if ((ret = virCommandRun(command, &status)) != 0 ||
             (WIFEXITED(status) && WEXITSTATUS(status) != 0)) {
             if (ret != 0) {
                 vah_error(NULL, 0, _("failed to run apparmor_parser"));
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virt-aa-helper: Use virCommand APIs directly
Posted by Ján Tomko 6 years, 5 months ago
On Mon, Aug 19, 2019 at 12:01:40PM +0200, Andrea Bolognani wrote:
>Right now we're using the virRun() convenience API, but that
>doesn't allow the kind of control we want. Use the virCommand
>APIs directly instead.
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> src/security/virt-aa-helper.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list