imay commented on a change in pull request #453: Add UserFunctionCache to cache 
UDF's library
URL: https://github.com/apache/incubator-doris/pull/453#discussion_r243576195
 
 

 ##########
 File path: be/src/util/file_utils.cpp
 ##########
 @@ -127,6 +127,43 @@ Status FileUtils::scan_dir(
     return Status::OK;
 }
 
+Status FileUtils::scan_dir(
+        const std::string& dir_path,
+        const std::function<bool(const std::string&, const std::string&)>& 
callback) {
+    auto dir_closer = [] (DIR* dir) { closedir(dir); };
+    std::unique_ptr<DIR, decltype(dir_closer)> dir(opendir(dir_path.c_str()), 
dir_closer);
+    if (dir == nullptr) {
+        char buf[64];
+        LOG(WARNING) << "fail to open dir, dir=" << dir_path << ", errmsg=" << 
strerror_r(errno, buf, 64);
+        return Status("fail to opendir");
+    }
+
+    struct dirent entry;
+    struct dirent* result = nullptr;
+    while (true) {
+        int ret = readdir_r(dir.get(), &entry, &result);
 
 Review comment:
   OK, I will change it 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org
For additional commands, e-mail: dev-h...@doris.apache.org

Reply via email to