From b278727bcf2c9c67e7437fdb8e2779bd8c1ccd7c Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 13 Feb 2026 17:16:36 -0800 Subject: [PATCH] Improve error message when creating a temporary file fails Add the temporary file path and the specific system error when `mkstemp` fails. PiperOrigin-RevId: 869948605 --- tsl/platform/path.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tsl/platform/path.cc b/tsl/platform/path.cc index e251972c7..65c1405a0 100644 --- a/tsl/platform/path.cc +++ b/tsl/platform/path.cc @@ -20,6 +20,8 @@ limitations under the License. #include #include #include + +#include #if defined(PLATFORM_WINDOWS) #include #else @@ -338,7 +340,8 @@ string GetTempFilename(const string& extension) { fd = mkstemp(&tmp_filepath[0]); } if (fd < 0) { - LOG(FATAL) << "Failed to create temp file."; + LOG(FATAL) << "Failed to create temp file " << tmp_filepath // Crash OK + << ", error: " << strerror(errno); } else { if (close(fd) < 0) { LOG(ERROR) << "close() failed: " << strerror(errno);