[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH V2 1/2] Fix building domain def in securityselinuxtest

On 08/17/2017 01:55 AM, Erik Skultety wrote:
On Wed, Aug 16, 2017 at 05:54:07PM -0600, Jim Fehlig wrote:
The virDomainDef created by testBuildDomainDef in securityselinuxtest
adds a seclabel but does not increment nseclabels. Also, it should
populate seclabel->model with 'selinux'.

While at it, use the secdef itself to populate values instead of
the indirection through def->seclabels[0].

Signed-off-by: Jim Fehlig <jfehlig suse com>
  tests/securityselinuxtest.c | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index 767b6cc02..f6143fb06 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -73,24 +73,28 @@ testBuildDomainDef(bool dynamic,
      if (!(def = virDomainDefNew()))
          goto error;

+    def->virtType = VIR_DOMAIN_VIRT_KVM;
      if (VIR_ALLOC_N(def->seclabels, 1) < 0)
          goto error;

+    def->nseclabels++;

Personally, I'd put the increment after assigning secdef to the domain
definition, but the memory chunk is zeroed out, so it doesn't matter at all.

I prefer it after the assignment too and moved it there.


Thanks! Pushed now.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]