X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Ftools.c;h=1eddf7e934ab9f658cadb9fe4e7a2c34b8312b15;hb=f22b5b1231f1e34c04cc5242feb152693f64b46e;hp=0a29ddf8e64cce7875a8a9d8c8fe37a0c6d90a13;hpb=2bce880a453a64d2d1dfc2e48184553ff4f2550b;p=ccan diff --git a/tools/tools.c b/tools/tools.c index 0a29ddf8..1eddf7e9 100644 --- a/tools/tools.c +++ b/tools/tools.c @@ -92,7 +92,6 @@ char *run_with_timeout(const void *ctx, const char *cmd, close_noerr(p[1]); return talloc_asprintf(ctx, "Failed to fork: %s", strerror(errno)); - return NULL; } if (pid == 0) { @@ -213,8 +212,7 @@ int unlink_file_destructor(char *filename) return 0; } -char *maybe_temp_file(const void *ctx, const char *extension, bool keep, - const char *srcname) +char *temp_file(const void *ctx, const char *extension, const char *srcname) { unsigned baselen; char *f, *suffix = talloc_strdup(ctx, ""); @@ -237,10 +235,7 @@ char *maybe_temp_file(const void *ctx, const char *extension, bool keep, } while (lstat(f, &st) == 0); if (tools_verbose) - printf("Creating %sfile %s\n", keep ? "" : "temporary ", f); - - if (!keep) - talloc_set_destructor(f, unlink_file_destructor); + printf("Creating file %s\n", f); talloc_free(suffix); return f;