X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpaths.c;h=7fcff9e0eaf3d8cc1ceb2e66cb68bbc279fd647f;hp=0d414ebaac0833a075b0f65532734e1620e46649;hb=07a5f9f1c50a9185851cd486d732976573d15c4f;hpb=dcc2bd8913d3741614e971b0be12f490d8334538 diff --git a/discover/paths.c b/discover/paths.c index 0d414eb..7fcff9e 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include @@ -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; @@ -220,15 +226,16 @@ static enum tftp_type check_tftp_type(void *ctx) const char *argv[] = { pb_system_apps.tftp, "-V", NULL }; struct process *process; enum tftp_type type; + int rc; process = process_create(ctx); process->path = pb_system_apps.tftp; process->argv = argv; process->keep_stdout = true; process->add_stderr = true; - process_run_sync(process); + rc = process_run_sync(process); - if (!process->stdout_buf || process->stdout_len == 0) { + if (rc || !process->stdout_buf || process->stdout_len == 0) { pb_log("Can't check TFTP client type!\n"); type = TFTP_TYPE_BROKEN; @@ -443,3 +450,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