summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dario Freni <dariofreni@google.com> 2022-01-06 13:38:42 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-01-06 13:38:42 +0000
commit70da2fc34998b59a90735eb3dc3e268c4411ea3d (patch)
treeb47a12ae9457ca03cfa5af4e3af41638ae01198f
parent1807050ff42a3ae781e328ddb0cda56622db6bad (diff)
parentb1e8640f7ea68087468be8c37d44fa17d9c7ef83 (diff)
Merge "Preserve attributes on rollback." am: b1e8640f7e
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1927454 Change-Id: I46d6af12c92cdf470ade3c38eedfc7a52b1c0517
-rw-r--r--cmds/installd/InstalldNativeService.cpp19
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);