[Release] wrt-installer_0.1.9
[platform/framework/web/wrt-installer.git] / src / jobs / widget_install / task_file_manipulation.cpp
index fddd770..db50d6b 100644 (file)
@@ -56,11 +56,15 @@ bool _FolderCopy(std::string source, std::string dest)
         return false;
     }
 
-    struct dirent* dEntry = NULL;
+    struct dirent dEntry;
+    struct dirent *dEntryResult;
+    int return_code;
+
     do {
         struct stat statInfo;
-        if (dEntry = readdir(dir)) {
-            std::string fileName = dEntry->d_name;
+        return_code = readdir_r(dir, &dEntry, &dEntryResult);
+        if (dEntryResult != NULL && return_code == 0) {
+            std::string fileName = dEntry.d_name;
             std::string fullName = source + "/" + fileName;
 
             if (stat(fullName.c_str(), &statInfo) != 0) {
@@ -88,7 +92,7 @@ bool _FolderCopy(std::string source, std::string dest)
             outfile.close();
             infile.close();
         }
-    } while (dEntry);
+    } while (dEntryResult != NULL && return_code == 0);
     closedir(dir);
     return true;
 }
@@ -98,7 +102,8 @@ namespace Jobs {
 namespace WidgetInstall {
 TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
     DPL::TaskDecl<TaskFileManipulation>(this),
-    m_context(context)
+    m_context(context),
+    m_extHandle(NULL)
 {
     if (INSTALL_LOCATION_TYPE_EXTERNAL !=
         m_context.locationType)