diff mbox

[11/24] petitboot: Add URL test to resolve_path

Message ID 20090413011137.356645188@am.sony.com
State Accepted
Headers show

Commit Message

Geoff Levand April 13, 2009, 1:11 a.m. UTC
Add a check to discover's resolve_path() to test if the path
is a URL, and if so just return that path.

If the path has "file://", treat it as a local path.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 discover/paths.c |    8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

--- a/discover/paths.c
+++ b/discover/paths.c
@@ -116,9 +116,17 @@  const char *mountpoint_for_device(const 
 
 char *resolve_path(void *alloc_ctx, const char *path, const char *current_dev)
 {
+	static const char s_file[] = "file://";
 	char *ret;
 	const char *devpath, *sep;
 
+	/* test for urls */
+
+	if (!strncasecmp(path, s_file, sizeof(s_file) - 1))
+		path += sizeof(s_file) - 1;
+	else if (strstr(path, "://"))
+		return talloc_strdup(alloc_ctx, path);
+
 	sep = strchr(path, ':');
 	if (!sep) {
 		devpath = mountpoint_for_device(current_dev);