chenhao7253886 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_r243502663
 
 

 ##########
 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:
   Readdir_r is deprecated, use readdir instead.  
   http://man7.org/linux/man-pages/man3/readdir_r.3.html

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to