Skip to content

Commit

Permalink
apps/netutils/netinit/netinit.c: Improve cleanup, removing 1 of 2 war…
Browse files Browse the repository at this point in the history
…nings. Unhook PHY notification signal handler when cleaning up, if an error occurs after the signal handler is put into place.
  • Loading branch information
hartmannathan authored and gregory-nutt committed Jul 26, 2019
1 parent 28f57f1 commit 4fd1058
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions netutils/netinit/netinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4fd1058

Please sign in to comment.