[11/29] discover: Add reference to url in load_url_result
diff mbox

Message ID 20161219041915.30497-12-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Samuel Mendoza-Jonas Dec. 19, 2016, 4:18 a.m. UTC
From: Jeremy Kerr <jk@ozlabs.org>

We may want to access the loaded URL in a async handler.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/paths.c    | 1 +
 discover/paths.h    | 1 +
 test/parser/utils.c | 1 +
 3 files changed, 3 insertions(+)

Patch
diff mbox

diff --git a/discover/paths.c b/discover/paths.c
index 7fcff9e..8d85619 100644
--- a/discover/paths.c
+++ b/discover/paths.c
@@ -383,6 +383,7 @@  struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
 	task->async = async_cb != NULL;
 	task->result = talloc_zero(ctx, struct load_url_result);
 	task->result->task = task;
+	task->result->url = url;
 	task->process = process_create(task);
 	if (task->async) {
 		task->async_cb = async_cb;
diff --git a/discover/paths.h b/discover/paths.h
index ed0e153..191b8dc 100644
--- a/discover/paths.h
+++ b/discover/paths.h
@@ -30,6 +30,7 @@  struct load_url_result {
 
 		LOAD_CANCELLED,
 	} status;
+	struct pb_url		*url;
 	const char		*local;
 	bool			cleanup_local;
 	struct load_task	*task;
diff --git a/test/parser/utils.c b/test/parser/utils.c
index 6bc7cc5..9d40d2b 100644
--- a/test/parser/utils.c
+++ b/test/parser/utils.c
@@ -353,6 +353,7 @@  struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
 		return NULL;
 
 	result->local = talloc_strdup(result, tmp);
+	result->url = url;
 	if (rc < 0)
 		result->status = LOAD_ERROR;
 	else