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 <mprivozn@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
This commit is contained in:
Michal Privoznik 2023-08-03 09:45:14 +02:00
parent 3b95df9eda
commit 7ce0fbccf1

View File

@ -134,7 +134,7 @@ virNetDaemonNew(void)
{ {
virNetDaemon *dmn; virNetDaemon *dmn;
#ifndef WIN32 #ifndef WIN32
struct sigaction sig_action; struct sigaction sig_action = { 0 };
#endif /* !WIN32 */ #endif /* !WIN32 */
if (virNetDaemonInitialize() < 0) if (virNetDaemonInitialize() < 0)
@ -160,7 +160,6 @@ virNetDaemonNew(void)
dmn->autoShutdownTimerID = -1; dmn->autoShutdownTimerID = -1;
#ifndef WIN32 #ifndef WIN32
memset(&sig_action, 0, sizeof(sig_action));
sig_action.sa_handler = SIG_IGN; sig_action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sig_action, NULL); sigaction(SIGPIPE, &sig_action, NULL);
#endif /* !WIN32 */ #endif /* !WIN32 */
@ -599,12 +598,10 @@ virNetDaemonSignalHandler(int sig, siginfo_t * siginfo,
{ {
int origerrno; int origerrno;
int r; int r;
siginfo_t tmp; siginfo_t tmp = { 0 };
if (SA_SIGINFO) if (SA_SIGINFO)
tmp = *siginfo; tmp = *siginfo;
else
memset(&tmp, 0, sizeof(tmp));
/* set the sig num in the struct */ /* set the sig num in the struct */
tmp.si_signo = sig; tmp.si_signo = sig;