aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/hadoop/hadoop_file_system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/platform/hadoop/hadoop_file_system.cc')
-rw-r--r--tensorflow/core/platform/hadoop/hadoop_file_system.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/tensorflow/core/platform/hadoop/hadoop_file_system.cc b/tensorflow/core/platform/hadoop/hadoop_file_system.cc
index 72c12318ca..ff4b4436bb 100644
--- a/tensorflow/core/platform/hadoop/hadoop_file_system.cc
+++ b/tensorflow/core/platform/hadoop/hadoop_file_system.cc
@@ -115,18 +115,17 @@ class LibHDFS {
const char* kLibHdfsDso = "libhdfs.so";
#endif
char* hdfs_home = getenv("HADOOP_HDFS_HOME");
- if (hdfs_home == nullptr) {
- status_ = errors::FailedPrecondition(
- "Environment variable HADOOP_HDFS_HOME not set");
- return;
- }
- string path = io::JoinPath(hdfs_home, "lib", "native", kLibHdfsDso);
- status_ = TryLoadAndBind(path.c_str(), &handle_);
- if (!status_.ok()) {
- // try load libhdfs.so using dynamic loader's search path in case
- // libhdfs.so is installed in non-standard location
- status_ = TryLoadAndBind(kLibHdfsDso, &handle_);
+ if (hdfs_home != nullptr) {
+ string path = io::JoinPath(hdfs_home, "lib", "native", kLibHdfsDso);
+ status_ = TryLoadAndBind(path.c_str(), &handle_);
+ if (status_.ok()) {
+ return;
+ }
}
+
+ // Try to load the library dynamically in case it has been installed
+ // to a in non-standard location.
+ status_ = TryLoadAndBind(kLibHdfsDso, &handle_);
}
Status status_;