Re: [PATCH 10/13] virnetdaemon.c: Use struct zero initializer instead of memset

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

 



On 8/3/23 12:36, Michal Privoznik wrote:
> Ideally, these would be fixed by coccinelle (see next commit),
> but because of various reasons they aren't. Fix them manually.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Reviewed-by: Claudio Fontana <cfontana@xxxxxxx>

> ---
>  src/rpc/virnetdaemon.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
> index 554b8852e4..d37984d207 100644
> --- a/src/rpc/virnetdaemon.c
> +++ b/src/rpc/virnetdaemon.c
> @@ -134,7 +134,7 @@ virNetDaemonNew(void)
>  {
>      virNetDaemon *dmn;
>  #ifndef WIN32
> -    struct sigaction sig_action;
> +    struct sigaction sig_action = { 0 };
>  #endif /* !WIN32 */
>  
>      if (virNetDaemonInitialize() < 0)
> @@ -160,7 +160,6 @@ virNetDaemonNew(void)
>      dmn->autoShutdownTimerID = -1;
>  
>  #ifndef WIN32
> -    memset(&sig_action, 0, sizeof(sig_action));
>      sig_action.sa_handler = SIG_IGN;
>      sigaction(SIGPIPE, &sig_action, NULL);
>  #endif /* !WIN32 */
> @@ -599,12 +598,10 @@ virNetDaemonSignalHandler(int sig, siginfo_t * siginfo,
>  {
>      int origerrno;
>      int r;
> -    siginfo_t tmp;
> +    siginfo_t tmp = { 0 };
>  
>      if (SA_SIGINFO)
>          tmp = *siginfo;
> -    else
> -        memset(&tmp, 0, sizeof(tmp));
>  
>      /* set the sig num in the struct */
>      tmp.si_signo = sig;




[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