X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpaths.c;h=5e577ebc7baeee7b96871339acbb6279fcc3cb56;hp=aa977fdba1f3d0bcbdbf84356a854877c202a17d;hb=af805399e80ae70a9fc7af9b47d76577be44a683;hpb=e983d818be18a975c519bd76294519a01ce7a1c3 diff --git a/discover/paths.c b/discover/paths.c index aa977fd..5e577eb 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -1,4 +1,6 @@ -#define _GNU_SOURCE +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif #include #include @@ -46,15 +48,17 @@ char *join_paths(void *alloc_ctx, const char *a, const char *b) static char *local_name(void *ctx) { - char *tmp, *ret; + char *ret, tmp[] = "/tmp/pb-XXXXXX"; + int fd; - tmp = tempnam(NULL, "pb-"); + fd = mkstemp(tmp); - if (!tmp) + if (fd < 0) return NULL; + close(fd); + ret = talloc_strdup(ctx, tmp); - free(tmp); return ret; } @@ -218,6 +222,7 @@ static enum tftp_type check_tftp_type(void *ctx) process->path = pb_system_apps.tftp; process->argv = argv; process->keep_stdout = true; + process->add_stderr = true; process_run_sync(process); if (!process->stdout_buf || process->stdout_len == 0) {