[PATCH 2/3] conf: Initialize _virNetworkObj::dnsmasqPid to -1 in virNetworkObjNew()

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

 



Throughout all of our network driver code we assume that
dnsmasqPid of value -1 means the network has no dnsmasq process
running. There are plenty of calls to:

  virNetworkObjSetDnsmasqPid(obj, -1);

or:

  pid_t dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
  if (dnsmasqPid > 0) ...;

Now, a virNetworkObj is created via virNetworkObjNew() which
might as well set this de-facto default value.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/virnetworkobj.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 1726fc381f..b8b86da06f 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -117,6 +117,7 @@ virNetworkObjNew(void)
     ignore_value(virBitmapSetBit(obj->classIdMap, 2));
 
     obj->ports = virHashNew(virNetworkObjPortFree);
+    obj->dnsmasqPid = (pid_t)-1;
 
     virObjectLock(obj);
 
-- 
2.39.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux