aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/env.cc
diff options
context:
space:
mode:
authorGravatar Rohan Jain <rohanj@google.com>2016-09-13 13:53:30 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-09-13 15:02:03 -0700
commitb694ceff1438dccd9751950f1a02a0d49936cd19 (patch)
tree803e7ded58518f37ef7a918e5adddd6d38b79b25 /tensorflow/core/platform/env.cc
parent805b23516bdf5b4009d584d7809606debd137c24 (diff)
Fixes the issue when RecursivelyCreateDir hangs when the input is the empty string.
Change: 133051324
Diffstat (limited to 'tensorflow/core/platform/env.cc')
-rw-r--r--tensorflow/core/platform/env.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/core/platform/env.cc b/tensorflow/core/platform/env.cc
index 9cb2c36839..16cdd561a3 100644
--- a/tensorflow/core/platform/env.cc
+++ b/tensorflow/core/platform/env.cc
@@ -142,7 +142,7 @@ Status Env::RecursivelyCreateDir(const string& dirname) {
TF_RETURN_IF_ERROR(GetFileSystemForFile(dirname, &fs));
std::vector<StringPiece> sub_dirs;
StringPiece remaining_dir(dirname);
- while (!fs->FileExists(remaining_dir.ToString())) {
+ while (!fs->FileExists(remaining_dir.ToString()) && !remaining_dir.empty()) {
// Basename returns "" for / ending dirs.
if (!remaining_dir.ends_with("/")) {
sub_dirs.push_back(io::Basename(remaining_dir));