]> git.ozlabs.org Git - petitboot/blobdiff - discover/user-event.c
discover: Don't rely on ctx->conf_url side-effect in user_event_parse_conf_url
[petitboot] / discover / user-event.c
index 61008c1a1cc484dd38c5d6dcd78795a2aa77e4ea..11a54df39f2fb6b966cd863f0b9ac431f6a235dc 100644 (file)
@@ -20,7 +20,6 @@
 #include "config.h"
 #endif
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
@@ -231,13 +230,13 @@ static char *parse_ip_addr(struct discover_context *ctx, const char *ip)
 }
 
 struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
-               struct event *event)
+               struct event *event, bool *is_complete)
 {
        const char *conffile, *host, *bootfile;
        char *p, *basedir, *url_str;
        struct pb_url *url;
 
-       conffile = event_get_param(event, "conffile");
+       conffile = event_get_param(event, "pxeconffile");
        if (conffile) {
                if (is_url(conffile)) {
                        url = pb_url_parse(ctx, conffile);
@@ -256,7 +255,7 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
                        talloc_free(url_str);
                }
 
-               ctx->conf_url = url;
+               *is_complete = true;
        } else {
                host = parse_host_addr(event);
                if (!host) {
@@ -285,6 +284,7 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
 
                talloc_free(url_str);
                talloc_free(basedir);
+               *is_complete = false;
        }
 
        return url;