]> git.ozlabs.org Git - petitboot/blobdiff - discover/paths.c
discover: Add reference to url in load_url_result
[petitboot] / discover / paths.c
index c25671b17a6a22404600da2a64cc9febca93f84f..8d856192b15a1acb0635bcf1c5db792c8a275898 100644 (file)
@@ -6,6 +6,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include <talloc/talloc.h>
 #include <system/system.h>
@@ -45,13 +47,17 @@ char *join_paths(void *alloc_ctx, const char *a, const char *b)
        return full_path;
 }
 
+#ifndef PETITBOOT_TEST
 
 static char *local_name(void *ctx)
 {
        char *ret, tmp[] = "/tmp/pb-XXXXXX";
+       mode_t oldmask;
        int fd;
 
+       oldmask = umask(0644);
        fd = mkstemp(tmp);
+       umask(oldmask);
 
        if (fd < 0)
                return NULL;
@@ -377,6 +383,7 @@ struct load_url_result *load_url_async(void *ctx, struct pb_url *url,
        task->async = async_cb != NULL;
        task->result = talloc_zero(ctx, struct load_url_result);
        task->result->task = task;
+       task->result->url = url;
        task->process = process_create(task);
        if (task->async) {
                task->async_cb = async_cb;
@@ -444,3 +451,33 @@ void load_url_async_cancel(struct load_url_result *res)
        res->status = LOAD_CANCELLED;
        process_stop_async(task->process);
 }
+
+#else
+
+static void __attribute__((unused)) load_local(
+               struct load_task *task __attribute__((unused)))
+{
+}
+static void __attribute__((unused)) load_wget(
+               struct load_task *task __attribute__((unused)),
+               int flags __attribute__((unused)))
+{
+}
+static void __attribute__((unused)) load_tftp(
+               struct load_task *task __attribute__((unused)))
+{
+}
+static void __attribute__((unused)) load_sftp(
+               struct load_task *task __attribute__((unused)))
+{
+}
+static void __attribute__((unused)) load_nfs(
+               struct load_task *task __attribute__((unused)))
+{
+}
+static void __attribute__((unused)) load_url_process_exit(
+               struct process *process __attribute__((unused)))
+{
+}
+
+#endif