From: Pawel Andruszkiewicz Date: Tue, 8 Mar 2016 09:53:13 +0000 (+0100) Subject: [Tools] Function readdir() replaced with readdir_r(). X-Git-Tag: submit/tizen/20160308.223939^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f89480af0c55e19348cc0c241b9e6daa320feba;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Tools] Function readdir() replaced with readdir_r(). Fixes: SVACE 41298 [Verification] This tool is used during compilation of webapi-plugins. After the modification, package code compiles, plugins run correctly. Change-Id: I10ae683c6e3ca2589602a9eab35f4429e1a58c85 Signed-off-by: Pawel Andruszkiewicz --- diff --git a/src/tool/desc_gentool.cc b/src/tool/desc_gentool.cc index b06db7b6..c93f5db9 100644 --- a/src/tool/desc_gentool.cc +++ b/src/tool/desc_gentool.cc @@ -164,10 +164,11 @@ int main(int argc, char* argv[]) { } DIR * dir; - struct dirent *ent; + struct dirent ent = {0}; + struct dirent* result = nullptr; if ((dir = opendir(tec_path.c_str())) != NULL) { - while ((ent = readdir(dir)) != NULL) { - std::string fname = ent->d_name; + while ((0 == (readdir_r(dir, &ent, &result))) && result) { + std::string fname = ent.d_name; if (fname.size() >= prefix_.size() + postfix_.size() && !fname.compare(0, prefix_.size(), prefix_) &&