X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fuser-event.c;h=1f7004509041123091ff85b9234c7e8b08133fed;hp=1e366ee387c6cad138998c2686d6ae0ef0832a51;hb=e596e8e66b014161116c207daa8d42cff849bfd2;hpb=f66b0807cace1cfda192810861ba6309bf6fa9fe diff --git a/discover/user-event.c b/discover/user-event.c index 1e366ee..1f70045 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -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); -}