From 4b94cfd3910de26dbca64cf746a899cbc635158b Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 11 Dec 2014 10:00:45 -0600 Subject: 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 --- partition.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'partition.cpp') diff --git a/partition.cpp b/partition.cpp index d84e48fae..b3c436f8b 100644 --- a/partition.cpp +++ b/partition.cpp @@ -42,6 +42,7 @@ #include "twrpDU.hpp" #include "fixPermissions.hpp" #include "infomanager.hpp" +#include "set_metadata.h" extern "C" { #include "mtdutils/mtdutils.h" #include "mtdutils/mounts.h" @@ -1748,6 +1749,7 @@ bool TWPartition::Backup_DD(string backup_folder) { Command = "dd if=" + Actual_Block_Device + " of='" + Full_FileName + "'" + " bs=" + DD_BS + " count=1"; LOGINFO("Backup command: '%s'\n", Command.c_str()); TWFunc::Exec_Cmd(Command); + tw_set_default_metadata(Full_FileName.c_str()); if (TWFunc::Get_File_Size(Full_FileName) == 0) { LOGERR("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str()); return false; @@ -1771,6 +1773,7 @@ bool TWPartition::Backup_Dump_Image(string backup_folder) { Command = "dump_image " + MTD_Name + " '" + Full_FileName + "'"; LOGINFO("Backup command: '%s'\n", Command.c_str()); TWFunc::Exec_Cmd(Command); + tw_set_default_metadata(Full_FileName.c_str()); if (TWFunc::Get_File_Size(Full_FileName) == 0) { // Actual size may not match backup size due to bad blocks on MTD devices so just check for 0 bytes LOGERR("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str()); -- cgit v1.2.3