diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-04 22:15:56 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-04 22:15:56 +0000 |
commit | 3e62dbf093c1ca2bc04f2042caa576adb21e572b (patch) | |
tree | d22f30a1dedc5d0f3e844fc18bc385f3990051d3 | |
parent | 16a932e83adddec5bdfe429927dadc33ef015e0b (diff) | |
parent | 5f906be393fa1609961d5e5324b55c5bfefaa165 (diff) | |
download | server_configurable_flags-simpleperf-release.tar.gz |
Snap for 11526323 from 5f906be393fa1609961d5e5324b55c5bfefaa165 to simpleperf-releasesimpleperf-release
Change-Id: Ie4f255e25f6231bef38770d5f12f6fdc41f26a40
-rw-r--r-- | aconfigd/aconfigd.cpp | 8 | ||||
-rw-r--r-- | aconfigd/aconfigd_util.cpp | 16 |
2 files changed, 10 insertions, 14 deletions
diff --git a/aconfigd/aconfigd.cpp b/aconfigd/aconfigd.cpp index 525c1d4..731c59c 100644 --- a/aconfigd/aconfigd.cpp +++ b/aconfigd/aconfigd.cpp @@ -134,10 +134,10 @@ Result<void> InitializePlatformStorage() { } auto value_files = std::vector<std::pair<std::string, std::string>>{ - {"system", "/system/etc"}, - {"system_ext", "/system_ext/etc"}, - {"vendor", "/vendor/etc"}, - {"product", "/product/etc"}}; + {"system", "/system/etc/aconfig"}, + {"system_ext", "/system_ext/etc/aconfig"}, + {"vendor", "/vendor/etc/aconfig"}, + {"product", "/product/etc/aconfig"}}; bool update_persistent_storage_records = false; for (auto const& [container, storage_dir] : value_files) { diff --git a/aconfigd/aconfigd_util.cpp b/aconfigd/aconfigd_util.cpp index 29720b6..fa8375d 100644 --- a/aconfigd/aconfigd_util.cpp +++ b/aconfigd/aconfigd_util.cpp @@ -18,6 +18,7 @@ #include <android-base/logging.h> #include <android-base/unique_fd.h> #include <android-base/file.h> +#include <sys/sendfile.h> #include "aconfigd_util.h" @@ -37,25 +38,20 @@ Result<void> CopyFile(const std::string& src, const std::string& dst) { } android::base::unique_fd dst_fd(TEMP_FAILURE_RETRY( - open(dst.c_str(), O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC | O_CLOEXEC, 0600))); + open(dst.c_str(), O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC | O_CLOEXEC, 0644))); if (dst_fd == -1) { return ErrnoError() << "open() failed for " << dst; } struct stat st; if (fstat(src_fd.get(), &st) == -1) { - return ErrnoError() << "fstat failed()"; + return ErrnoError() << "fstat() failed"; } auto len = st.st_size; - off_t ret; - do { - ret = copy_file_range(src_fd, NULL, dst_fd, NULL, len, 0); - if (ret == -1) { - return ErrnoError() << "copy_file_range failed"; - } - len -= ret; - } while (len > 0 && ret > 0); + if (sendfile(dst_fd, src_fd, nullptr, len) == -1) { + return ErrnoError() << "sendfile() failed"; + } return {}; } |