summaryrefslogtreecommitdiffstats
path: root/fsck_unshare_blocks.cpp
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2018-11-30 23:38:41 +0100
committerandroid-build-merger <android-build-merger@google.com>2018-11-30 23:38:41 +0100
commit0a53c37bce7cb27f4ff35cbc117ce7656076fc51 (patch)
tree3698dae3205a75a789bd25571404a51c90c631c7 /fsck_unshare_blocks.cpp
parentMerge "Update for long long -> off64_t for fstab.length" am: 1f66578d6f (diff)
parentMerge "SYSTEM_ROOT -> get_system_root" (diff)
downloadandroid_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar.gz
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar.bz2
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar.lz
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar.xz
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.tar.zst
android_bootable_recovery-0a53c37bce7cb27f4ff35cbc117ce7656076fc51.zip
Diffstat (limited to 'fsck_unshare_blocks.cpp')
-rw-r--r--fsck_unshare_blocks.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/fsck_unshare_blocks.cpp b/fsck_unshare_blocks.cpp
index 684958e38..b653d13ce 100644
--- a/fsck_unshare_blocks.cpp
+++ b/fsck_unshare_blocks.cpp
@@ -40,7 +40,6 @@
static constexpr const char* SYSTEM_E2FSCK_BIN = "/system/bin/e2fsck_static";
static constexpr const char* TMP_E2FSCK_BIN = "/tmp/e2fsck.bin";
-static constexpr const char* SYSTEM_ROOT = "/system";
static bool copy_file(const char* source, const char* dest) {
android::base::unique_fd source_fd(open(source, O_RDONLY));
@@ -121,14 +120,10 @@ bool do_fsck_unshare_blocks() {
std::vector<std::string> partitions = { "/odm", "/oem", "/product", "/vendor" };
// Temporarily mount system so we can copy e2fsck_static.
- bool mounted = false;
- if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) {
- mounted = ensure_path_mounted_at("/", "/mnt/system") != -1;
- partitions.push_back("/");
- } else {
- mounted = ensure_path_mounted_at(SYSTEM_ROOT, "/mnt/system") != -1;
- partitions.push_back(SYSTEM_ROOT);
- }
+ std::string system_root = get_system_root();
+ bool mounted = ensure_path_mounted_at(system_root.c_str(), "/mnt/system");
+ partitions.push_back(system_root);
+
if (!mounted) {
LOG(ERROR) << "Failed to mount system image.";
return false;