]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMMain.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMMain.cpp
index 7b47e90035841b8cafb42d19a26113b6246ba121..fa5a96fe6931bbe00025a8a822487dd3b9c5e032 100644 (file)
@@ -176,10 +176,11 @@ bool modelCDMMain::OpenProject(
 
   //check if Makefile file exists
   std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile";
-  FILE* pFile = fopen(pathMakefile.c_str(), "r");
+  FILE* pFile;
+  errno_t errorOpen = fopen_s(&pFile, pathMakefile.c_str(), "r");
 
   //is the binary folder
-  if (pFile != NULL)
+  if (!errorOpen && pFile)
     {
       fclose(pFile);
       std::ifstream readFile;
@@ -206,10 +207,10 @@ bool modelCDMMain::OpenProject(
   std::string pathSource = "";
   //check if CMakeLists file exists
   std::string pathCMakeLists = pathFixed + CDMUtilities::SLASH + "CMakeLists.txt";
-  pFile = fopen(pathCMakeLists.c_str(), "r");
+  errorOpen = fopen_s(&pFile, pathCMakeLists.c_str(), "r");
 
   //is the source folder
-  if (pFile != NULL)
+  if (!errorOpen && pFile)
     {
       fclose(pFile);
       std::ifstream readFile;