From 7ce0fbccf1df61e7dfd86d1cbb863f82c36c494c Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Thu, 3 Aug 2023 09:45:14 +0200 Subject: [PATCH] virnetdaemon.c: Use struct zero initializer instead of memset 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 Reviewed-by: Claudio Fontana --- 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; -- 2.47.2