+ mark `def` as `const`
+ allow NULL `def`
+ allow NULL `src`

Upcoming patches will need these

Signed-off-by: Cole Robinson <[email protected]>
---
 src/qemu/qemu_domain.c | 8 +++++---
 src/qemu/qemu_domain.h | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f494c6469b..d3daa0fe17 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6276,7 +6276,7 @@ qemuDomainCleanupRun(virQEMUDriver *driver,
 
 void
 qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
-                      virDomainDef *def,
+                      const virDomainDef *def,
                       virStorageSource *src,
                       virStorageSource *parentSrc,
                       uid_t *uid, gid_t *gid)
@@ -6289,7 +6289,8 @@ qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
     if (gid)
         *gid = cfg->group;
 
-    if ((vmlabel = virDomainDefGetSecurityLabelDef(def, "dac")) &&
+    if (def &&
+        (vmlabel = virDomainDefGetSecurityLabelDef(def, "dac")) &&
         vmlabel->label)
         virParseOwnershipIds(vmlabel->label, uid, gid);
 
@@ -6298,7 +6299,8 @@ qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
         disklabel->label)
         virParseOwnershipIds(disklabel->label, uid, gid);
 
-    if ((disklabel = virStorageSourceGetSecurityLabelDef(src, "dac")) &&
+    if (src &&
+        (disklabel = virStorageSourceGetSecurityLabelDef(src, "dac")) &&
         disklabel->label)
         virParseOwnershipIds(disklabel->label, uid, gid);
 }
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index b321a64e96..c8f0d2326c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -728,7 +728,7 @@ bool qemuDomainDiskChangeSupported(virDomainDiskDef *disk,
                                    virDomainDiskDef *orig_disk);
 
 void qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
-                           virDomainDef *def,
+                           const virDomainDef *def,
                            virStorageSource *src,
                            virStorageSource *parentSrc,
                            uid_t *uid,
-- 
2.53.0

Reply via email to