projects
/
framework
/
web
/
wrt-installer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Release] wrt-installer_0.1.9
[framework/web/wrt-installer.git]
/
src
/
jobs
/
widget_install
/
task_plugins_copy.cpp
diff --git
a/src/jobs/widget_install/task_plugins_copy.cpp
b/src/jobs/widget_install/task_plugins_copy.cpp
index
0e72ced
..
bf295ea
100644
(file)
--- a/
src/jobs/widget_install/task_plugins_copy.cpp
+++ b/
src/jobs/widget_install/task_plugins_copy.cpp
@@
-20,11
+20,13
@@
* @brief Copying plugins delivered in widget package.
*/
* @brief Copying plugins delivered in widget package.
*/
+#include <unistd.h>
#include "task_plugins_copy.h"
#include <dpl/log/log.h>
#include <dpl/string.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/errno_string.h>
#include "task_plugins_copy.h"
#include <dpl/log/log.h>
#include <dpl/string.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/errno_string.h>
+#include <widget_install/job_widget_install.h>
#include <widget_install_context.h>
#include <widget_install/widget_install_errors.h>
#include <dpl/exception.h>
#include <widget_install_context.h>
#include <widget_install/widget_install_errors.h>
#include <dpl/exception.h>
@@
-83,7
+85,6
@@
void TaskPluginsCopy::StepFindPlugins()
/* Find all .so files and store their names in list */
DIR *dir;
/* Find all .so files and store their names in list */
DIR *dir;
- struct dirent *entry;
struct stat st;
LogDebug("Opening plugins directory");
dir = opendir(m_npsource.c_str());
struct stat st;
LogDebug("Opening plugins directory");
dir = opendir(m_npsource.c_str());
@@
-92,10
+93,17
@@
void TaskPluginsCopy::StepFindPlugins()
ThrowMsg(Exceptions::InternalError, "Unable to read plugins directory");
}
std::string tempname;
ThrowMsg(Exceptions::InternalError, "Unable to read plugins directory");
}
std::string tempname;
+ struct dirent entry;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
const std::string ext(".so");
/* Listing directory and checking entries found inside */
const std::string ext(".so");
/* Listing directory and checking entries found inside */
- while ((entry = readdir(dir)) != NULL) {
- tempname = m_npsource + "/" + entry->d_name;
+ for (return_code = readdir_r(dir, &entry, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &entry, &result))
+ {
+ tempname = m_npsource + "/" + entry.d_name;
if (lstat(tempname.c_str(), &st) != 0) {
LogWarning(
"Failed to call \"lstat\" (errno:" << errno
if (lstat(tempname.c_str(), &st) != 0) {
LogWarning(
"Failed to call \"lstat\" (errno:" << errno
@@
-105,11
+113,11
@@
void TaskPluginsCopy::StepFindPlugins()
}
/* Directories other than "." and ".." should not be found*/
if (S_ISDIR(st.st_mode)) {
}
/* Directories other than "." and ".." should not be found*/
if (S_ISDIR(st.st_mode)) {
- if (strncmp(entry
->
d_name, "..", 2) != 0
- && strncmp(entry
->
d_name, ".", 1) != 0)
+ if (strncmp(entry
.
d_name, "..", 2) != 0
+ && strncmp(entry
.
d_name, ".", 1) != 0)
{
LogError("Directory detected instead of plugin file: "
{
LogError("Directory detected instead of plugin file: "
- << entry
->
d_name);
+ << entry
.
d_name);
/* Subdirectories inside plugins/ARCH are not supported */
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError(
/* Subdirectories inside plugins/ARCH are not supported */
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError(
@@
-125,7
+133,7
@@
void TaskPluginsCopy::StepFindPlugins()
}
}
}
}
- tempname = std::string(entry
->
d_name);
+ tempname = std::string(entry
.
d_name);
/* Check whether file extension is ".so" */
if (tempname.compare(tempname.size() - ext.size(), ext.size(),
ext) == 0)
/* Check whether file extension is ".so" */
if (tempname.compare(tempname.size() - ext.size(), ext.size(),
ext) == 0)
@@
-138,6
+146,10
@@
void TaskPluginsCopy::StepFindPlugins()
LogWarning("Non-plugin file found: " << tempname);
}
}
LogWarning("Non-plugin file found: " << tempname);
}
}
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+ errno = 0;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << m_npsource << " with error: "
<< DPL::GetErrnoString());
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << m_npsource << " with error: "
<< DPL::GetErrnoString());
@@
-169,7
+181,7
@@
void TaskPluginsCopy::StepCopyPlugins()
/* Copy plugins from widget package into
* .netscape/plugins in widget's target directory */
for (std::list<std::string>::const_iterator it = m_nplugins.begin();
/* Copy plugins from widget package into
* .netscape/plugins in widget's target directory */
for (std::list<std::string>::const_iterator it = m_nplugins.begin();
- it != m_nplugins.end();
it++
)
+ it != m_nplugins.end();
++it
)
{
LogDebug("Copying plugin file: " << (*it));
source = m_npsource + "/" + (*it);
{
LogDebug("Copying plugin file: " << (*it));
source = m_npsource + "/" + (*it);
@@
-194,6
+206,10
@@
void TaskPluginsCopy::StepCopyPlugins()
"Failed to plugins source remove directory");
}
LogDebug("Plugins copying step ended");
"Failed to plugins source remove directory");
}
LogDebug("Plugins copying step ended");
+
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_PLUGINS_COPY,
+ "Plugins copy");
}
void TaskPluginsCopy::StepCopyingFinished()
}
void TaskPluginsCopy::StepCopyingFinished()