Mercurial > pidgin.yaz
changeset 13530:2e10680b7545
[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 <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Mon, 20 Mar 2006 18:11:29 +0000 |
parents | 43268b823440 |
children | 703e5ba8fb82 |
files | COPYRIGHT src/proxy.c |
diffstat | 2 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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! */