# HG changeset patch # User Ethan Blanton # Date 1142878289 0 # Node ID 2e10680b75455f094cf6359a290a6154f7353946 # Parent 43268b8234408f9da2cc00a2674d245d425ea08a [gaim-migrate @ 15907] Patch from Julien Bossart to change our DNS child liveness test to one using waitpid instead of kill. This is still sort of a heuristic, because we could conceivably have some *other* child with the same PID (say, a sound fork), but that's reasonably unlikely and this check is certainly more reliable than the previous check. committer: Tailor Script diff -r 43268b823440 -r 2e10680b7545 COPYRIGHT --- a/COPYRIGHT Mon Mar 20 17:27:51 2006 +0000 +++ b/COPYRIGHT Mon Mar 20 18:11:29 2006 +0000 @@ -32,6 +32,7 @@ Jason Boerner Graham Booker Paolo Borelli +Julien Bossart Craig Boston Chris Boyle Derrick J Brashear diff -r 43268b823440 -r 2e10680b7545 src/proxy.c --- a/src/proxy.c Mon Mar 20 17:27:51 2006 +0000 +++ b/src/proxy.c Mon Mar 20 18:11:29 2006 +0000 @@ -544,12 +544,21 @@ { char ch; int rc; + pid_t pid; - /* Are you alive? */ - if (kill(req->dns_pid, 0) != 0) { + /* This waitpid might return the child's PID if it has recently + * exited, or it might return an error if it exited "long + * enough" ago that it has already been reaped; in either + * instance, we can't use it. */ + if ((pid = waitpid (req->dns_pid, NULL, WNOHANG)) > 0) { gaim_debug_warning("dns", "DNS child %d no longer exists\n", req->dns_pid); return -1; + } else if (pid < 0) { + gaim_debug_warning("dns", + "Wait for DNS child %d failed: %s\n", + req->dns_pid, strerror(errno)); + return -1; } /* Let's contact this lost child! */