diff options
| author | 2021-12-22 01:00:01 +0000 | |
|---|---|---|
| committer | 2021-12-22 01:00:55 +0000 | |
| commit | 918beeb8926349bd74b09bbe38c01b7e99c84faa (patch) | |
| tree | 97ddb6d725aa893517818a0cd6ade4ece7e9f589 | |
| parent | a98ef807a612f81cf75dd4c83ba09e00d2df6ebf (diff) | |
Preserve attributes on rollback.
Bug: 211570674
Bug: 195477363
Test: atest RollbackTest (test modified in a separate CL)
Change-Id: Ic5b8a7c7ace1efe32fc2ce1afeb6485a542bcea4
| -rw-r--r-- | cmds/installd/InstalldNativeService.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index 3b29e2bd16..c3256fcfff 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -1131,16 +1131,15 @@ binder::Status InstalldNativeService::fixupAppData(const std::optional<std::stri } static int32_t copy_directory_recursive(const char* from, const char* to) { - char *argv[] = { - (char*) kCpPath, - (char*) "-F", /* delete any existing destination file first (--remove-destination) */ - (char*) "-p", /* preserve timestamps, ownership, and permissions */ - (char*) "-R", /* recurse into subdirectories (DEST must be a directory) */ - (char*) "-P", /* Do not follow symlinks [default] */ - (char*) "-d", /* don't dereference symlinks */ - (char*) from, - (char*) to - }; + char* argv[] = + {(char*)kCpPath, + (char*)"-F", /* delete any existing destination file first (--remove-destination) */ + (char*)"--preserve=mode,ownership,timestamps,xattr", /* preserve properties */ + (char*)"-R", /* recurse into subdirectories (DEST must be a directory) */ + (char*)"-P", /* Do not follow symlinks [default] */ + (char*)"-d", /* don't dereference symlinks */ + (char*)from, + (char*)to}; LOG(DEBUG) << "Copying " << from << " to " << to; return logwrap_fork_execvp(ARRAY_SIZE(argv), argv, nullptr, false, LOG_ALOG, false, nullptr); |