Skip to content
Snippets Groups Projects
Commit 81bb3158 authored by Yuri Kunde Schlesner's avatar Yuri Kunde Schlesner Committed by GitHub
Browse files

Merge pull request #2064 from linkmauve/remove-readdir_r

Switch to readdir() from readdir_r()
parents f4bb89ce 519e7013
No related branches found
No related tags found
No related merge requests found
......@@ -457,14 +457,12 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo
do {
const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName));
#else
struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(directory.c_str());
if (!dirp)
return false;
// non windows loop
while (!readdir_r(dirp, &dirent, &result) && result) {
while (struct dirent* result = readdir(dirp)) {
const std::string virtual_name(result->d_name);
#endif
......@@ -560,12 +558,10 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
if (!FileUtil::Exists(source_path)) return;
if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path);
struct dirent dirent, *result = nullptr;
DIR *dirp = opendir(source_path.c_str());
if (!dirp) return;
while (!readdir_r(dirp, &dirent, &result) && result)
{
while (struct dirent* result = readdir(dirp)) {
const std::string virtualName(result->d_name);
// check for "." and ".."
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment