[PATCH 3/3] networkRefreshDhcpDaemon: Get dnsmasq's PID once

Michal Privoznik posted 3 patches 2 years, 8 months ago
[PATCH 3/3] networkRefreshDhcpDaemon: Get dnsmasq's PID once
Posted by Michal Privoznik 2 years, 8 months ago
This is a relict of v3.7.0-rc1~132 when getter/setter APIs for
dnsmasq's PID were introduced. Previously, obj->dnsmasqPid was
accessed directly. But the aforementioned commit introduced two
calls to virNetworkObjGetDnsmasqPid() even though the result of
the first call is stored in a variable.

Remove the second call as it's unnecessary.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/network/bridge_driver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 7f2298a15e..9eb543a0a3 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1599,7 +1599,6 @@ networkRefreshDhcpDaemon(virNetworkDriverState *driver,
     if (dnsmasqSave(dctx) < 0)
         return -1;
 
-    dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
     return kill(dnsmasqPid, SIGHUP);
 
 }
-- 
2.39.2
Re: [PATCH 3/3] networkRefreshDhcpDaemon: Get dnsmasq's PID once
Posted by Laine Stump 2 years, 7 months ago
On 4/17/23 8:09 AM, Michal Privoznik wrote:
> This is a relict of v3.7.0-rc1~132 when getter/setter APIs for

s/relict/relic/ :-)

(also, I like using the upstream commit ID (preceded by the word 
"commit" to identify a particular commit, because gitk automagically 
turns that into a link that can be clicked.)

> dnsmasq's PID were introduced. Previously, obj->dnsmasqPid was
> accessed directly. But the aforementioned commit introduced two
> calls to virNetworkObjGetDnsmasqPid() even though the result of
> the first call is stored in a variable.
> 
> Remove the second call as it's unnecessary.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>   src/network/bridge_driver.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 7f2298a15e..9eb543a0a3 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -1599,7 +1599,6 @@ networkRefreshDhcpDaemon(virNetworkDriverState *driver,
>       if (dnsmasqSave(dctx) < 0)
>           return -1;
>   
> -    dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
>       return kill(dnsmasqPid, SIGHUP);
>   
>   }