X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fuser-event.c;h=1f7004509041123091ff85b9234c7e8b08133fed;hp=7acd237234848d453740592cc0d16c2cad09a78d;hb=cf651e02fb7a34545211708c2a285cd228645531;hpb=f2acf9d2573ebbfb7478e97c4066c128ddaa5a18 diff --git a/discover/user-event.c b/discover/user-event.c index 7acd237..1f70045 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -89,9 +89,9 @@ static struct resource *user_event_resource(struct discover_boot_option *opt, return NULL; } - boot_file = event_get_param(event, "boot_file"); + boot_file = event_get_param(event, "bootfile"); if (!boot_file) { - pb_log("%s: boot_file not found\n", __func__); + pb_log("%s: bootfile not found\n", __func__); return NULL; } @@ -208,7 +208,7 @@ static char *parse_mac_addr(struct discover_context *ctx, const char *mac) mac_addr_arr + 2, mac_addr_arr + 3, mac_addr_arr + 4, mac_addr_arr + 5); - mac_addr = talloc_asprintf(ctx, "01-%02X-%02X-%02X-%02X-%02X-%02X", + mac_addr = talloc_asprintf(ctx, "01-%02x-%02x-%02x-%02x-%02x-%02x", mac_addr_arr[0], mac_addr_arr[1], mac_addr_arr[2], mac_addr_arr[3], mac_addr_arr[4], mac_addr_arr[5]); @@ -290,8 +290,9 @@ struct pb_url *user_event_parse_conf_url(struct discover_context *ctx, /* strip filename from the bootfile path, leaving only a * directory */ p = strrchr(basedir, '/'); - if (p) - *p = '\0'; + if (!p) + p = basedir; + *p = '\0'; if (strlen(basedir)) url_str = talloc_asprintf_append(url_str, "%s/", @@ -504,15 +505,15 @@ static int user_event_destructor(void *arg) return 0; } -struct user_event *user_event_init(struct waitset *waitset, - struct device_handler *handler) +struct user_event *user_event_init(struct device_handler *handler, + struct waitset *waitset) { struct sockaddr_un addr; struct user_event *uev; unlink(PBOOT_USER_EVENT_SOCKET); - uev = talloc(NULL, struct user_event); + uev = talloc(handler, struct user_event); uev->handler = handler; @@ -545,8 +546,3 @@ out_err: talloc_free(uev); return NULL; } - -void user_event_destroy(struct user_event *uev) -{ - talloc_free(uev); -}