diff options
author | Paul Smith <psmith@gnu.org> | 2022-10-29 11:09:42 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-10-29 13:36:21 -0400 |
commit | 11f9da227e8b31e1831522214f4e088857d787f1 (patch) | |
tree | 93ec44b8a8e4efd9f9a25f1a2b65d9491ba4e230 /src | |
parent | b92340a1eab22a3125c1e61850610cd2121457a6 (diff) | |
download | make-git-11f9da227e8b31e1831522214f4e088857d787f1.tar.gz |
* src/posixos.c (os_anontmp): [SV 63287] Only fail O_TMPFILE once
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
Diffstat (limited to 'src')
-rw-r--r-- | src/posixos.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/posixos.c b/src/posixos.c index 48e8cf5c..63201b40 100644 --- a/src/posixos.c +++ b/src/posixos.c @@ -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 |