summaryrefslogtreecommitdiff
path: root/resolver.c
diff options
context:
space:
mode:
authorchris <>2003-11-06 21:43:31 +0000
committerchris <>2003-11-06 21:43:31 +0000
commitfbef5fdbc041d865daff316f51d8bf8d1e414116 (patch)
tree71757bc9335739b66785b3ca04665a9c65d7f8cf /resolver.c
parent027a02428bf332e2d8c860ac28c8f043ef564879 (diff)
downloadiftop-fbef5fdbc041d865daff316f51d8bf8d1e414116.zip
""
Diffstat (limited to 'resolver.c')
-rw-r--r--resolver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/resolver.c b/resolver.c
index 1cec32d..43539dc 100644
--- a/resolver.c
+++ b/resolver.c
@@ -320,7 +320,7 @@ char *do_resolve(struct in_addr *addr) {
workerinfo = xmalloc(sizeof *workerinfo);
pthread_setspecific(worker_key, workerinfo);
workerinfo->fd = p[0];
-
+
switch (workerinfo->child = fork()) {
case 0:
close(p[0]);
@@ -332,6 +332,7 @@ char *do_resolve(struct in_addr *addr) {
return NULL;
default:
+fprintf(stderr, "New child is %d, we have fd %d, he has fd %d\n", workerinfo->child, p[0], p[1]);
close(p[1]);
}
}
@@ -340,11 +341,13 @@ char *do_resolve(struct in_addr *addr) {
if (write(workerinfo->fd, addr, sizeof *addr) != sizeof *addr
|| read(workerinfo->fd, name, NAMESIZE) != NAMESIZE) {
/* Something went wrong. Just kill the child and get on with it. */
+fprintf(stderr, "Protocol error (%s) talking to child %d\n", strerror(errno), workerinfo->child);
kill(workerinfo->child, SIGKILL);
wait();
close(workerinfo->fd);
xfree(workerinfo);
pthread_setspecific(worker_key, NULL);
+ *name = 0;
}
if (!*name)
return NULL;