[all-commits] [llvm/llvm-project] b4722c: [libc++][test] Fix infinite loop when mkstemp fails
Ryan Prichard via All-commits
all-commits at lists.llvm.org
Fri Jul 22 16:21:21 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b4722cc4c96e03cdad3f23b0ba558907e82d95db
https://github.com/llvm/llvm-project/commit/b4722cc4c96e03cdad3f23b0ba558907e82d95db
Author: Ryan Prichard <rprichard at google.com>
Date: 2022-07-22 (Fri, 22 Jul 2022)
Changed paths:
M libcxx/test/support/platform_support.h
Log Message:
-----------
[libc++][test] Fix infinite loop when mkstemp fails
mkstemp is guaranteed to make at least TMP_MAX attempts to create the
random file, and if it can't, it fails with EEXIST. get_temp_file_name
shouldn't call mkstemp again if it fails with anything other than
EEXIST. A single mkstemp call seems sufficient.
On Android, I've seen mkstemp fail with:
- EROFS (because cwd wasn't set to a writable filesystem)
- EACCES (because cwd pointed to a dir owned by root, but the test
program was running as the shell user instead)
Previously, get_temp_file_name would run forever in these situations.
See D4962 and "llvm-svn: 229035"
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D130214
More information about the All-commits
mailing list