Removing compilation warnings in wrt-installer repo
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_update_files.cpp
index bcbd2f3..e3fabf0 100644 (file)
@@ -244,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");