X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fpaths.c;h=64b218e820d2f06ec508584a7b4a2fddea0fc5b6;hp=aa977fdba1f3d0bcbdbf84356a854877c202a17d;hb=d67d5beceef94686818ce264b2ca93f82b66e8f4;hpb=e983d818be18a975c519bd76294519a01ce7a1c3 diff --git a/discover/paths.c b/discover/paths.c index aa977fd..64b218e 100644 --- a/discover/paths.c +++ b/discover/paths.c @@ -46,15 +46,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; }