void *async_data;
};
-static inline bool have_busybox(void)
-{
-#ifdef WITH_BUSYBOX
- return true;
-#else
- return false;
-#endif
-}
-
const char *mount_base(void)
{
return DEVICE_MOUNT_BASE;
#ifndef PETITBOOT_TEST
+#ifdef WITH_BUSYBOX
+static inline bool have_busybox(void) { return true; }
+#else
+static inline bool have_busybox(void) { return false; }
+#endif
+
static char *local_name(void *ctx)
{
char *ret, tmp[] = "/tmp/pb-XXXXXX";
*/
static void load_local(struct load_task *task)
{
+ struct load_url_result *result = task->result;
int rc;
rc = access(task->url->path, F_OK);
if (rc) {
- task->result->status = LOAD_ERROR;
+ result->status = LOAD_ERROR;
} else {
- task->result->local = talloc_strdup(task->result,
- task->url->path);
- task->result->status = LOAD_OK;
+ result->local = talloc_strdup(task->result, task->url->path);
+ result->status = LOAD_OK;
}
+
+ task->async_cb(task->result, task->async_data);
}
static void load_url_async_start_pending(struct load_task *task, int flags)
return NULL;
}
- if (!task->async)
+ if (!task->async || result->status == LOAD_OK)
talloc_free(task);
return result;