]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* doc/make.texi: Document temporary file name prefix
authorPaul Smith <psmith@gnu.org>
Sun, 24 Mar 2024 20:23:28 +0000 (16:23 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 24 Mar 2024 20:23:28 +0000 (16:23 -0400)
* src/posixos.c (jobserver_setup): Set prefix for FIFO temp file.
Ensure it can't conflict with a "normal" temp file.
* src/w32/w32os.c (os_anontmp): Set prefix for anon temp files.

doc/make.texi
src/posixos.c
src/w32/w32os.c

index 5efae41cbaa13dd117c9d2af8e3ccf92fbcca0cc..874152f3247b720ad9e6c499ee2d5106ea2b6f11 100644 (file)
@@ -9462,7 +9462,8 @@ regardless of any @code{.WARNINGS} assignments.
 
 In some situations, @code{make} will need to create its own temporary files.
 These files must not be disturbed while @code{make} is running, including all
-recursively-invoked instances of @code{make}.
+recursively-invoked instances of @code{make}.  All temporary filenames created
+by GNU Make will start with the letters @samp{Gm}.
 
 @cindex @code{MAKE_TMPDIR}
 If the environment variable @code{MAKE_TMPDIR} is set then all temporary files
index 7a723591a7a0fada65d631f164ffe8dce8db9664..6b0b716e79b638272d8ba14665757dd45a0489a9 100644 (file)
@@ -152,13 +152,14 @@ jobserver_setup (int slots, const char *style)
     {
   /* Unfortunately glibc warns about uses of mktemp even though we aren't
      using it in dangerous way here.  So avoid this by generating our own
-     temporary file name.  */
-# define  FNAME_PREFIX "GMfifo"
+     temporary file name.  The template in misc.c uses 6 X's so be sure this
+     name cannot conflict with that.  */
+# define  FNAME_PREFIX "GmFIFO"
       const char *tmpdir = get_tmpdir ();
 
       fifo_name = xmalloc (strlen (tmpdir) + CSTRLEN (FNAME_PREFIX)
                            + INTSTR_LENGTH + 2);
-      sprintf (fifo_name, "%s/" FNAME_PREFIX "%" MK_PRI64_PREFIX "d",
+      sprintf (fifo_name, "%s/" FNAME_PREFIX "%03" MK_PRI64_PREFIX "d",
                tmpdir, (long long)make_pid ());
 
       EINTRLOOP (r, mkfifo (fifo_name, 0600));
index ac8fc59cb0e309297ba0559a2c5518e3fce7fb07..af02621ed8d0eb88774a44551eb19d9e0df99164 100644 (file)
@@ -129,7 +129,7 @@ os_anontmp ()
   static unsigned uniq = 0;
   static int second_loop = 0;
 
-  const char base[] = "gmake_tmpf";
+  const char base[] = "GmTMPF";
   const unsigned sizemax = sizeof (base) - 1 + 4 + 10 + 10;
   unsigned pid = GetCurrentProcessId ();