- if (task->state == BOOT_STATE_IMAGE_LOADING) {
- if (task->initrd) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_INFO, "loading initrd");
- task->local_initrd = load_url_async(task, task->initrd,
- &clean_initrd, boot_process);
- if (!task->local_initrd) {
- update_status(task->status_fn, task->status_arg,
- BOOT_STATUS_ERROR,
- "Couldn't load initrd image");
- goto no_load;
- } else {
- task->state = BOOT_STATE_INITRD_LOADING;
- *status = 0;
- return;
- }
- } else {
- task->state = BOOT_STATE_INITRD_LOADING;
- }
- }
+static void cleanup_load(struct load_url_result *result)
+{
+ if (!result)
+ return;
+ if (result->status != LOAD_OK)
+ return;
+ if (!result->cleanup_local)
+ return;
+ unlink(result->local);
+}