@@ -116,6 +116,7 @@ struct _GResolv {
GResolvDebugFunc debug_func;
gpointer debug_data;
+ int err;
};
#define debug(resolv, format, arg...) \
@@ -1060,7 +1061,8 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
if (resolv->result_family != AF_INET6) {
if (add_query(lookup, hostname, ns_t_a)) {
g_free(lookup);
- return -EIO;
+ resolv->err = -EIO;
+ return 0;
}
}
@@ -1073,7 +1075,8 @@ guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
}
g_free(lookup);
- return -EIO;
+ resolv->err = -EIO;
+ return 0;
}
}
@@ -1119,3 +1122,11 @@ bool g_resolv_set_address_family(GResolv *resolv, int family)
return true;
}
+
+int g_resolv_get_error(GResolv *resolv)
+{
+ if (!resolv)
+ return 0;
+
+ return resolv->err;
+}
@@ -71,6 +71,8 @@ bool g_resolv_cancel_lookup(GResolv *resolv, guint id);
bool g_resolv_set_address_family(GResolv *resolv, int family);
+int g_resolv_get_error(GResolv *resolv);
+
#ifdef __cplusplus
}
#endif