summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2018-11-30 23:07:24 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-30 23:07:24 +0100
commitcbfeb7f6af298fa3babc58a38097fac1ee30d077 (patch)
treebae82ab18649e10b004851d75b253904ee1326ea /roots.cpp
parentMerge "Update for long long -> off64_t for fstab.length" (diff)
parentSYSTEM_ROOT -> get_system_root (diff)
downloadandroid_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar.gz
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar.bz2
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar.lz
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar.xz
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.tar.zst
android_bootable_recovery-cbfeb7f6af298fa3babc58a38097fac1ee30d077.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/roots.cpp b/roots.cpp
index 8772c577a..7dc4ec3d9 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -45,6 +45,7 @@
static struct fstab* fstab = nullptr;
static bool did_map_logical_partitions = false;
+static constexpr const char* SYSTEM_ROOT = "/system";
extern struct selabel_handle* sehandle;
@@ -408,3 +409,11 @@ int setup_install_mounts() {
bool logical_partitions_mapped() {
return did_map_logical_partitions;
}
+
+std::string get_system_root() {
+ if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) {
+ return "/";
+ } else {
+ return SYSTEM_ROOT;
+ }
+}