From: Soyoung Kim Date: Thu, 20 Jun 2013 11:53:33 +0000 (+0900) Subject: change directory owner during update web app. X-Git-Tag: submit/tizen_2.2/20130716.180435~1^2~51 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fweb%2Fwrt-installer.git;a=commitdiff_plain;h=90074dd2db27c65c1ef7c958c95093b6211a8c08 change directory owner during update web app. [Issue#] N/A [Problem] private directory owner changed to root during update web app. [Cause] because of copy backup directory. [Solution] chage owner to app during update web app. [SCMRequest] N/A Change-Id: Id3719ef0fec9236c318e047c7da27b5ab107e42d --- diff --git a/src/jobs/widget_install/directory_api.cpp b/src/jobs/widget_install/directory_api.cpp index 678ec1d..a43b24c 100644 --- a/src/jobs/widget_install/directory_api.cpp +++ b/src/jobs/widget_install/directory_api.cpp @@ -71,6 +71,8 @@ bool DirectoryCopy(std::string source, std::string dest) outfile << infile.rdbuf(); outfile.close(); infile.close(); + + chown(destFile.c_str(), statInfo.st_uid, statInfo.st_gid); } } while (dEntryResult != NULL && return_code == 0); closedir(dir); diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index c3c7123..181e85e 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -205,17 +205,17 @@ void TaskFileManipulation::StepCreatePrivateStorageDir() LogDebug("Create private storage directory : " << m_context.locations->getPrivateStorageDir()); + changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE); + if (m_context.isUpdateMode) { //update std::string backData = m_context.locations->getBackupPrivateDir(); LogDebug("copy private storage " << backData << " to " << storagePath); - WrtUtilMakeDir(storagePath); if (!DirectoryApi::DirectoryCopy(backData, storagePath)) { LogError("Failed to rename " << backData << " to " << storagePath); ThrowMsg(Exceptions::BackupFailed, "Error occurs copy private strage files"); } } - changeOwnerForDirectory(storagePath, PRIVATE_STORAGE_MODE); std::string tempStoragePath = m_context.locations->getPrivateTempStorageDir(); LogDebug("Create temp private storage directory : " << tempStoragePath);