]> git.ozlabs.org Git - petitboot/blobdiff - discover/paths.c
Various fixups and checks to make scan-build happy
[petitboot] / discover / paths.c
index dd54ba2bc178289e6ba240c04e24af485ee8c1cf..16fdd597444d19856f1aad00cb810aa3ee68657e 100644 (file)
@@ -118,6 +118,8 @@ static void load_url_process_exit(struct process *process)
        } else {
                result->status = LOAD_ERROR;
                load_url_result_cleanup_local(result);
        } 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)
        }
 
        if (result->status == LOAD_OK && process->stdout_data)
@@ -156,7 +158,7 @@ static int busybox_progress_cb(void *arg)
        p = procinfo_get_process(procinfo);
        handler = p->stdout_data;
 
        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 */
 
        if (rc) {
                /* Unregister ourselves from progress tracking */
@@ -184,8 +186,10 @@ static int busybox_progress_cb(void *arg)
                                }
        }
 
                                }
        }
 
-       if (rc != 3)
+       if (rc != 3) {
                percentage = size = 0;
                percentage = size = 0;
+               suffix = ' ';
+       }
 
        device_handler_status_download(handler, procinfo,
                        percentage, size, suffix);
 
        device_handler_status_download(handler, procinfo,
                        percentage, size, suffix);
@@ -446,7 +450,8 @@ static void load_local(struct load_task *task)
                result->status = LOAD_OK;
        }
 
                result->status = LOAD_OK;
        }
 
-       task->async_cb(task->result, task->async_data);
+       if (task->async_cb)
+               task->async_cb(task->result, task->async_data);
 }
 
 static void load_url_async_start_pending(struct load_task *task, int flags)
 }
 
 static void load_url_async_start_pending(struct load_task *task, int flags)
@@ -582,12 +587,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 the url is remote but network is not yet available queue up this
         * load for later */
-       if (url->scheme != pb_url_file &&
-                       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;
+       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) {
        }
 
        switch (url->scheme) {