]> git.ozlabs.org Git - ccan/blobdiff - tools/tools.c
ccanlint: chdir to temporary dir so gcov files land there.
[ccan] / tools / tools.c
index 7de02e3b9dfdcc2ae1604d6db5c6d46a1466ecc7..eacfbf9c8d353ac89bb7e782b19d379e0aefd1a1 100644 (file)
@@ -172,7 +172,7 @@ static int unlink_all(char *dir)
        return 0;
 }
 
-char *temp_file(const void *ctx, const char *extension)
+char *temp_dir(const void *ctx)
 {
        /* For first call, create dir. */
        while (!tmpdir) {
@@ -192,8 +192,13 @@ char *temp_file(const void *ctx, const char *extension)
                }
                talloc_set_destructor(tmpdir, unlink_all);
        }
+       return tmpdir;
+}
 
-       return talloc_asprintf(ctx, "%s/%u%s", tmpdir, count++, extension);
+char *temp_file(const void *ctx, const char *extension)
+{
+       return talloc_asprintf(ctx, "%s/%u%s",
+                              temp_dir(ctx), count++, extension);
 }
 
 char *maybe_temp_file(const void *ctx, const char *extension, bool keep,