]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* src/posixos.c (os_anontmp): [SV 63287] Only fail O_TMPFILE once
authorPaul Smith <psmith@gnu.org>
Sat, 29 Oct 2022 15:09:42 +0000 (11:09 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 29 Oct 2022 17:36:21 +0000 (13:36 -0400)
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.

src/posixos.c

index 48e8cf5c195a316a0e1d4b3c359afcb595cb6fd0..63201b400403cd996dd7b43a698cf57f87a9c244 100644 (file)
@@ -843,12 +843,18 @@ os_anontmp ()
   int fd = -1;
 
 #ifdef O_TMPFILE
-  EINTRLOOP (fd, open (tdir, O_RDWR | O_TMPFILE | O_EXCL, 0600));
-  if (fd >= 0)
-    return fd;
+  static unsigned int tmpfile_works = 1;
 
-  DB (DB_BASIC, (_("Cannot open '%s' with O_TMPFILE: %s.\n"),
-                 tdir, strerror (errno)));
+  if (tmpfile_works)
+    {
+      EINTRLOOP (fd, open (tdir, O_RDWR | O_TMPFILE | O_EXCL, 0600));
+      if (fd >= 0)
+        return fd;
+
+      DB (DB_BASIC, (_("Cannot open '%s' with O_TMPFILE: %s.\n"),
+                     tdir, strerror (errno)));
+      tmpfile_works = 0;
+    }
 #endif
 
 #if HAVE_DUP