diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-07-27 19:06:42 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-27 19:06:42 -0700 |
commit | 7a9883b749cb810698d8572eb5bf90a8259471cf (patch) | |
tree | d2e1f1422b5bb088263213768ddea5c157a2124d | |
parent | 654d99b98b0a6c9468c74d1a9054e850bfeaede1 (diff) | |
download | connman-7a9883b749cb810698d8572eb5bf90a8259471cf.tar.gz connman-7a9883b749cb810698d8572eb5bf90a8259471cf.tar.bz2 connman-7a9883b749cb810698d8572eb5bf90a8259471cf.zip |
Fix result status handling with resolver library callback
-rw-r--r-- | gresolv/gresolv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gresolv/gresolv.c b/gresolv/gresolv.c index ba19672f..66b2641b 100644 --- a/gresolv/gresolv.c +++ b/gresolv/gresolv.c @@ -193,6 +193,7 @@ static void parse_response(struct resolv_nameserver *nameserver, const unsigned char *buf, int len) { GResolv *resolv = nameserver->resolv; + GResolvResultStatus status; GList *list; char **results; ns_msg msg; @@ -209,6 +210,11 @@ static void parse_response(struct resolv_nameserver *nameserver, debug(resolv, "msg id: 0x%04x rcode: %d count: %d", ns_msg_id(msg), rcode, count); + if (rcode == 0) + status = G_RESOLV_STATUS_SUCCESS; + else + status = G_RESOLV_STATUS_ERROR; + results = g_try_new(char *, count + 1); if (results == NULL) return; @@ -241,8 +247,8 @@ static void parse_response(struct resolv_nameserver *nameserver, struct resolv_query *query = list->data; if (query->result_func != NULL) - query->result_func(G_RESOLV_STATUS_SUCCESS, - results, query->result_data); + query->result_func(status, results, + query->result_data); destroy_query(query); g_queue_remove(resolv->query_queue, query); |