summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--discover/paths.c10
1 files changed, 6 insertions, 4 deletions
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;
}
OpenPOWER on IntegriCloud