]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser.c
discover/resource: create_url_resource should take ownership of url
[petitboot] / discover / parser.c
index 6896075ed1742b82b4e9306a5b1072556c8463df..a304f0c989e32f4e124d1f62647547b067d952b5 100644 (file)
@@ -29,23 +29,22 @@ static char *local_path(struct discover_context *ctx,
 
 static int download_config(struct discover_context *ctx, char **buf, int *len)
 {
-       unsigned tempfile;
-       const char *file;
+       struct load_url_result *result;
        int rc;
 
-       file = load_url(ctx, ctx->conf_url, &tempfile);
-       if (!file)
+       result = load_url(ctx, ctx->conf_url);
+       if (!result)
                return -1;
 
-       rc = read_file(ctx, file, buf, len);
+       rc = read_file(ctx, result->local, buf, len);
        if (rc)
                goto out_clean;
 
        return 0;
 
 out_clean:
-       if (tempfile)
-               unlink(file);
+       if (result->cleanup_local)
+               unlink(result->local);
        return -1;
 }
 
@@ -125,6 +124,8 @@ void __register_parser(struct parser *parser)
 {
        struct p_item* i = talloc(NULL, struct p_item);
 
+       printf("%s: %s\n", __func__, parser->name);
+
        i->parser = parser;
        list_add(&parsers, &i->list);
 }