]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser.c
discover: Add struct load_url_result and load_task
[petitboot] / discover / parser.c
index 7d9cd0d4f439487f7907f872efd6a019c1f27378..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;
 }