Fix prevent issue
authorLukasz Marek <l.marek@samsung.com>
Fri, 1 Feb 2013 11:43:32 +0000 (12:43 +0100)
committerGerrit Code Review <gerrit2@kim11>
Wed, 6 Feb 2013 08:20:11 +0000 (17:20 +0900)
[Issue#] N/A
[Bug] remove function is called without checking result.
[Cause] N/A
[Solution] check addded
[Verification] Verification steps
1. Install widget
2. Manipulate database to add non-existing locations.
3. During updating(or -if installation) or uninstalling this files should be listed as external files to be removed but not existing(warning in logs)

Change-Id: I6f4652e19b36354e39d3e339897d3cc374ce6641

src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/widget_install_errors.h

index de38c5f..ea2cd3c 100644 (file)
@@ -190,7 +190,10 @@ void TaskDatabase::StepRemoveExternalFiles()
         if(WrtUtilFileExists(*file))
         {
             LogDebug("  -> " << *file);
-            remove(file->c_str());
+            if (-1 == TEMP_FAILURE_RETRY(remove(file->c_str()))) {
+                ThrowMsg(Exceptions::RemovingFileFailure,
+                         "Failed to remove external file");
+            }
         }
         else if(WrtUtilDirExists(*file))
         {
index b3bf040..32ef9b0 100644 (file)
@@ -82,6 +82,7 @@ DECLARE_JOB_EXCEPTION(Base, AlreadyInstalled, ErrorAlreadyInstalled)
 DECLARE_JOB_EXCEPTION(Base, UnknownError, ErrorUnknown)
 DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorDatabaseFailure)
 DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorRemovingFolderFailure)
+DECLARE_JOB_EXCEPTION(Base, RemovingFileFailure, ErrorRemovingFolderFailure)
 DECLARE_JOB_EXCEPTION(Base, CreateVconfFailure, ErrorCreateVconfFailure)
 
 DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorUnknown)