Removing compilation warnings in wrt-installer repo
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_update_files.cpp
index c9afcca..e3fabf0 100644 (file)
@@ -20,6 +20,7 @@
  * @brief   Implementation file for installer task update files
  */
 
+#include <unistd.h>
 #include <utility>
 #include <vector>
 #include <string>
@@ -243,8 +244,17 @@ void TaskUpdateFiles::StepExecFileBackup()
     std::string clientPath = GlobalConfig::GetWrtClientExec();
 
     LogInfo("link -s " << clientPath << " " << execFile);
-    symlink(clientPath.c_str(), execFile.c_str());
 
+    errno = 0;
+    if( symlink(clientPath.c_str(), execFile.c_str()) != 0 )
+    {
+        int error = errno;
+        if(error)
+            LogPedantic("Failed to make a symbolic name for a file "
+                    << "[" <<  DPL::GetErrnoString(error) << "]");
+        ThrowMsg(Exceptions::BackupFailed,
+                "Error occurs during rename file");
+    }
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_BACKUP_EXEC,
         "Backup execution file for update");