[glib/glib-2-36] GThreadedResolver: set an error if no records could be found
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-36] GThreadedResolver: set an error if no records could be found
- Date: Sun, 9 Jun 2013 22:40:09 +0000 (UTC)
commit 03d3a53876b8e015a8f4f428fe31b15b5d8ec300
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Mar 29 15:39:26 2013 +0100
GThreadedResolver: set an error if no records could be found
It is possible that the upstream servers return something, but
we then filter all results because they are of the wrong type.
In that case the API and subsequent GTask calls expect a GError
to be set.
https://bugzilla.gnome.org/show_bug.cgi?id=696857
gio/gthreadedresolver.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index def85b8..2332adf 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -472,6 +472,14 @@ g_resolver_records_from_res_query (const gchar *rrname,
records = g_list_prepend (records, record);
}
+ if (records == NULL)
+ {
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
+ _("No DNS record of the requested type for '%s'"), rrname);
+
+ return NULL;
+ }
+ else
return records;
}
@@ -616,7 +624,15 @@ g_resolver_records_from_DnsQuery (const gchar *rrname,
records = g_list_prepend (records, g_variant_ref_sink (record));
}
- return records;
+ if (records == NULL)
+ {
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
+ _("No DNS record of the requested type for '%s'"), rrname);
+
+ return NULL;
+ }
+ else
+ return records;
}
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]