[PATCH v2 05/22] gweb: Added 'g_web_result_get_err'.

Grant Erickson <[email protected]>
Newsgroups dev.linux.lists.connman
Message-ID <3e0b57485a7f50f031d7853b01a40a4821704e05.1741059516.git.gerickson@nuovations.com>
Returns the operating system error, if any, associated with the web
session request result.
---
 gweb/gweb.c | 9 +++++++++
 gweb/gweb.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/gweb/gweb.c b/gweb/gweb.c
index d79d2d0808cd..6ada0dfa571c 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -55,6 +55,7 @@ enum chunk_state {
 };
 
 struct _GWebResult {
+	int err;
 	guint16 status;
 	const guint8 *buffer;
 	gsize length;
@@ -2462,6 +2463,14 @@ bool g_web_cancel_request(GWeb *web, guint id)
 	return true;
 }
 
+int g_web_result_get_err(const GWebResult *result)
+{
+	if (!result)
+		return -EINVAL;
+
+	return result->err;
+}
+
 guint16 g_web_result_get_status(GWebResult *result)
 {
 	if (!result)
diff --git a/gweb/gweb.h b/gweb/gweb.h
index 90cccadbe883..e9a8eda9f8f7 100644
--- a/gweb/gweb.h
+++ b/gweb/gweb.h
@@ -162,6 +162,7 @@ guint g_web_request_post_file(GWeb *web, const char *url,
 
 bool g_web_cancel_request(GWeb *web, guint id);
 
+int g_web_result_get_err(const GWebResult *result);
 guint16 g_web_result_get_status(GWebResult *result);
 
 bool g_web_result_get_header(GWebResult *result,
-- 
2.45.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.