X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpaths.c;h=54b843e77ce3d8df07bdf2df906c6c1231f327bc;hp=c5b577823746f1c7cab1cc02f176baf494782ff5;hb=8789ca2374c1f7fef21e393c81bc0f0dfddaacae;hpb=2b86765dfa37f9b447fe983967c1dcbc712a4989 diff --git a/discover/paths.c b/discover/paths.c index c5b5778..54b843e 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -3,11 +3,13 @@ #endif #include +#include #include #include #include -#include +#include #include +#include #include #include @@ -116,6 +118,8 @@ static void load_url_process_exit(struct process *process) } else { result->status = LOAD_ERROR; load_url_result_cleanup_local(result); + pb_debug("Download client stdout buffer:\n%s\n", + process->stdout_buf); } if (result->status == LOAD_OK && process->stdout_data) @@ -154,7 +158,7 @@ static int busybox_progress_cb(void *arg) p = procinfo_get_process(procinfo); handler = p->stdout_data; - rc = process_stdout_custom(procinfo, &line); + rc = process_process_stdout(procinfo, &line); if (rc) { /* Unregister ourselves from progress tracking */ @@ -182,8 +186,10 @@ static int busybox_progress_cb(void *arg) } } - if (rc != 3) + if (rc != 3) { percentage = size = 0; + suffix = ' '; + } device_handler_status_download(handler, procinfo, percentage, size, suffix); @@ -547,6 +553,7 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url, { struct load_url_result *result; struct load_task *task; + struct addrinfo *res; int flags = 0; if (!url) @@ -579,11 +586,14 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url, /* If the url is remote but network is not yet available queue up this * load for later */ - if (!system_info_network_available() && url->scheme != pb_url_file) { - pb_log("load task for %s queued pending network\n", url->full); - pending_network_jobs_add(task, flags); - task->result->status = LOAD_ASYNC; - return task->result; + if (url->scheme != pb_url_file) { + if (getaddrinfo(url->host, NULL, NULL, &res) != 0) { + pb_log("load task for %s queued pending network\n", url->full); + pending_network_jobs_add(task, flags); + task->result->status = LOAD_ASYNC; + return task->result; + } + freeaddrinfo(res); } switch (url->scheme) {