Browse Source

Check the return code of the waitpid calls. (Closes: #688470)

We want to know if the right child exited in the cleanup functions.
Given that waitpid is invoked with WNOHANG we get bogus results
otherwise.

Signed-off-by: Philipp Kern <pkern@debian.org>
tags/1.93
Philipp Kern 8 years ago
parent
commit
d5888b99ac
4 changed files with 19 additions and 4 deletions
  1. +4
    -1
      autoconfig.c
  2. +7
    -0
      debian/changelog
  3. +4
    -1
      dhcp.c
  4. +4
    -2
      rdnssd.c

+ 4
- 1
autoconfig.c View File

@@ -47,7 +47,10 @@ void cleanup_dhcpv6_client(void)
/* Already cleaned up */
return;

waitpid(dhcpv6_pid, &dhcpv6_exit_status, WNOHANG);
if (waitpid(dhcpv6_pid, &dhcpv6_exit_status, WNOHANG) != dhcpv6_pid)
/* Wasn't us */
return;

if (WIFEXITED(dhcpv6_exit_status) || WIFSIGNALED(dhcpv6_exit_status))
dhcpv6_pid = -1;
}


+ 7
- 0
debian/changelog View File

@@ -1,3 +1,10 @@
netcfg (1.93) UNRELEASED; urgency=low

* Check the return code of the waitpid calls found in various cleanup
routines. (Closes: #688470)

-- Philipp Kern <pkern@debian.org> Mon, 24 Sep 2012 23:55:32 +0200

netcfg (1.92) unstable; urgency=low

[ Philipp Kern ]


+ 4
- 1
dhcp.c View File

@@ -115,7 +115,10 @@ static void cleanup_dhcp_client(void)
/* Already cleaned up */
return;

waitpid(dhcp_pid, &dhcp_exit_status, WNOHANG);
if (waitpid(dhcp_pid, &dhcp_exit_status, WNOHANG) != dhcp_pid)
/* Wasn't us */
return;

if (WIFEXITED(dhcp_exit_status))
dhcp_pid = -1;
}


+ 4
- 2
rdnssd.c View File

@@ -69,8 +69,10 @@ void cleanup_rdnssd()
/* Definitely wasn't us */
return;
waitpid(rdnssd_pid, &exit_status, WNOHANG);
if (waitpid(rdnssd_pid, &exit_status, WNOHANG) != rdnssd_pid)
/* Not us either */
return;

if (WIFEXITED(exit_status))
/* Yep, that was me */
rdnssd_pid = -1;


Loading…
Cancel
Save