From 4fd105820073369d71342e16292e745859586f7c Mon Sep 17 00:00:00 2001 From: Nathan Hartman Date: Fri, 26 Jul 2019 10:58:14 -0600 Subject: [PATCH] apps/netutils/netinit/netinit.c: Improve cleanup, removing 1 of 2 warnings. Unhook PHY notification signal handler when cleaning up, if an error occurs after the signal handler is put into place. --- netutils/netinit/netinit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netutils/netinit/netinit.c b/netutils/netinit/netinit.c index 74aa9c288..414701490 100644 --- a/netutils/netinit/netinit.c +++ b/netutils/netinit/netinit.c @@ -555,6 +555,7 @@ static int netinit_monitor(void) struct timespec reltime; struct ifreq ifr; struct sigaction act; + struct sigaction oact; bool devup; int ret; int sd; @@ -584,7 +585,7 @@ static int netinit_monitor(void) act.sa_sigaction = netinit_signal; act.sa_flags = SA_SIGINFO; - ret = sigaction(CONFIG_NETINIT_SIGNO, &act, NULL); + ret = sigaction(CONFIG_NETINIT_SIGNO, &act, &oact); if (ret < 0) { ret = -errno; @@ -758,7 +759,7 @@ static int netinit_monitor(void) errout_with_notification: # warning Missing logic errout_with_sigaction: -# warning Missing logic + (void)sigaction(CONFIG_NETINIT_SIGNO, &oact, NULL); errout_with_socket: close(sd); errout: