diff options
author | Paul Smith <psmith@gnu.org> | 2022-08-01 12:57:12 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-08-02 23:36:35 -0400 |
commit | 09cce75c308a6e7ae0f3635724d2ae87e72f9800 (patch) | |
tree | 76b706491cd21acd9f87d80da6c8ea4852506692 /src/vmsjobs.c | |
parent | 07eea3aa496184bb763b7306e9de6a40a94605c9 (diff) | |
download | make-git-09cce75c308a6e7ae0f3635724d2ae87e72f9800.tar.gz |
Enhance get_tmpfile() and add get_tmppath()
Move all the logic on creating temporary files into misc.c, and add
a new function get_tmppath() that returns the pathname to a temporary
file without creating or opening it.
* src/makeint.h: Add a declaration for get_tmppath(). Remove the
template argument from get_tmpfile(): it will compute its own.
* src/main.c (main): Remove the logic for computing templates.
* src/vmsjobs.c (child_execute_job): Ditto.
* src/misc.c (get_tmptemplate): New function to return an allocated
template string for use with various mktemp-style functions.
(get_tmppath): Return an allocated path to a temporary file, but do
not create it. Generally this should be avoided due to TOCTOU issues.
(get_tmpfile): Use get_tmptemplate() to generate a template rather
than using one passed in. If we don't have mkstemp() then use
get_tmppath() to compute the path of a temp file.
Diffstat (limited to 'src/vmsjobs.c')
-rw-r--r-- | src/vmsjobs.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/vmsjobs.c b/src/vmsjobs.c index ef4ed064..e3226acf 100644 --- a/src/vmsjobs.c +++ b/src/vmsjobs.c @@ -1241,9 +1241,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv) FILE *outfile; int cmd_len; - outfile = get_tmpfile (&child->comname, - "sys$scratch:gnv$make_cmdXXXXXX.com"); - /* 123456789012345678901234567890 */ + outfile = get_tmpfile (&child->comname); if (outfile == 0) pfatal_with_name (_("fopen (temporary file)")); comnamelen = strlen (child->comname); |