diff --git a/tensorflow/c/env.cc b/tensorflow/c/env.cc index 43879a18359..6d8528bc42f 100644 --- a/tensorflow/c/env.cc +++ b/tensorflow/c/env.cc @@ -147,14 +147,8 @@ TF_StringStream* TF_GetLocalTempDirectories() { return list; } -void TF_GetTempFileName(const char* extension, std::string* name, - TF_Status* status) { - *name = ::tensorflow::io::GetTempFilename(extension); - if (name->length() == 0) { - TF_SetStatus(status, TF_INTERNAL, "Can not get temp file name"); - } else { - TF_SetStatus(status, TF_OK, ""); - } +void TF_GetTempFileName(const char* extension, char** name) { + *name = strdup(::tensorflow::io::GetTempFilename(extension).c_str()); } TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void) { diff --git a/tensorflow/c/env.h b/tensorflow/c/env.h index 273a3b5e142..29ec417a75e 100644 --- a/tensorflow/c/env.h +++ b/tensorflow/c/env.h @@ -20,8 +20,6 @@ limitations under the License. #include #include -#include - #include "tensorflow/c/c_api.h" #include "tensorflow/c/tf_file_statistics.h" @@ -157,8 +155,7 @@ TF_CAPI_EXPORT extern TF_StringStream* TF_GetLocalTempDirectories(void); // Creates a temporary file name with an extension. // The caller is responsible for freeing the returned pointer. TF_CAPI_EXPORT extern void TF_GetTempFileName(const char* extension, - std::string* name, - TF_Status* status); + char** name); // Returns the number of nanoseconds since the Unix epoch. TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void); diff --git a/tensorflow/core/platform/path.cc b/tensorflow/core/platform/path.cc index f9442ccba0f..1e88328aace 100644 --- a/tensorflow/core/platform/path.cc +++ b/tensorflow/core/platform/path.cc @@ -327,8 +327,6 @@ string GetTempFilename(const string& extension) { } LOG(FATAL) << "No temp directory found."; #endif - // Return an empty string to indicate that we can not create temp file name. - return ""; } bool GetTestUndeclaredOutputsDir(string* dir) {