1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-09 01:18:00 +03:00

conf: Initialize _virNetworkObj::dnsmasqPid to -1 in virNetworkObjNew()

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2023-04-17 10:10:04 +02:00
parent 212dfa94ee
commit 004d5141c5

View File

@ -117,6 +117,7 @@ virNetworkObjNew(void)
ignore_value(virBitmapSetBit(obj->classIdMap, 2));
obj->ports = virHashNew(virNetworkObjPortFree);
obj->dnsmasqPid = (pid_t)-1;
virObjectLock(obj);