On Tuesday, 19 September 2017 13:38:27 CEST Richard W.M. Jones wrote:
diff --git a/lib/command.c b/lib/command.c index bc469de59..7018c3ac0 100644 --- a/lib/command.c +++ b/lib/command.c @@ -815,8 +815,9 @@ guestfs_int_cmd_pipe_run (struct command *cmd, const char *mode) if (guestfs_int_lazy_make_tmpdir (cmd->g) == -1) goto error;
- cmd->error_file = - safe_asprintf (cmd->g, "%s/cmderr.%d", cmd->g->tmpdir, ++cmd->g->unique); + cmd->error_file = guestfs_int_make_temp_path (cmd->g, "cmderr", "txt"); + if (!cmd->error_file) + goto error; errfd = open (cmd->error_file, O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC|O_CLOEXEC, 0600); if (errfd == -1) { diff --git a/lib/drives.c b/lib/drives.c index 117c8bf85..f43e64b10 100644 --- a/lib/drives.c +++ b/lib/drives.c @@ -989,7 +989,9 @@ guestfs_impl_add_drive_scratch (guestfs_h *g, int64_t size, */ if (guestfs_int_lazy_make_tmpdir (g) == -1) return -1; - filename = safe_asprintf (g, "%s/scratch.%d", g->tmpdir, ++g->unique); + filename = guestfs_int_make_temp_path (g, "scratch", "img"); + if (!filename) + return -1;
/* Create a raw format temporary disk. */ if (guestfs_disk_create (g, filename, "raw", size, -1) == -1)
The calls to guestfs_int_lazy_make_tmpdir can be removed in the files above, like done already in the launch-*.c files. -- Pino Toscano