Attempt to set the proper uid/gid/contexts on new files and dirs
Files and folders that we create during backups, copy log, or MTP operations often do not have the proper uid/gid/contexts assigned. We will attempt to read the proper contexts from the settings storage path and assign those same contexts to any files or dirs that we create. Change-Id: I769f9479854122b49b499de2175e6e2d026f8afd
This commit is contained in:
@@ -52,6 +52,7 @@ extern "C" {
|
||||
#include "cutils/properties.h"
|
||||
#include "../minadbd/adb.h"
|
||||
#include "../adb_install.h"
|
||||
#include "../set_metadata.h"
|
||||
|
||||
int TWinstall_zip(const char* path, int* wipe_cache);
|
||||
void run_script(const char *str1, const char *str2, const char *str3, const char *str4, const char *str5, const char *str6, const char *str7, int request_confirm);
|
||||
@@ -503,6 +504,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
|
||||
PartitionManager.Mount_Current_Storage(true);
|
||||
dst = DataManager::GetCurrentStoragePath() + "/recovery.log";
|
||||
TWFunc::copy_file("/tmp/recovery.log", dst.c_str(), 0755);
|
||||
tw_set_default_metadata(dst.c_str());
|
||||
sync();
|
||||
gui_print("Copied recovery log to %s.\n", DataManager::GetCurrentStoragePath().c_str());
|
||||
} else
|
||||
@@ -1222,6 +1224,12 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
|
||||
int check = 0;
|
||||
std::string theme_path;
|
||||
|
||||
if (tw_get_default_metadata(DataManager::GetSettingsStoragePath().c_str()) != 0) {
|
||||
LOGERR("Failed to get default contexts and file mode for storage files.\n");
|
||||
} else {
|
||||
LOGINFO("Got default contexts and file mode for storage files.\n");
|
||||
}
|
||||
|
||||
theme_path = DataManager::GetSettingsStoragePath();
|
||||
if (PartitionManager.Mount_By_Path(theme_path.c_str(), 1) < 0) {
|
||||
LOGERR("Unable to mount %s during reload function startup.\n", theme_path.c_str());
|
||||
|
||||
Reference in New Issue
Block a user