Loading adb/remount_service.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <string> #include <android-base/file.h> #include <android-base/properties.h> #include "adb.h" Loading @@ -36,6 +37,8 @@ #include "adb_utils.h" #include "fs_mgr.h" using android::base::Realpath; // Returns the device used to mount a directory in /proc/mounts. static std::string find_proc_mount(const char* dir) { std::unique_ptr<FILE, int(*)(FILE*)> fp(setmntent("/proc/mounts", "r"), endmntent); Loading @@ -43,9 +46,15 @@ static std::string find_proc_mount(const char* dir) { return ""; } // dir might be a symlink, e.g., /product -> /system/product in GSI. std::string canonical_path; if (!Realpath(dir, &canonical_path)) { PLOG(ERROR) << "Realpath failed: " << dir; } mntent* e; while ((e = getmntent(fp.get())) != nullptr) { if (strcmp(dir, e->mnt_dir) == 0) { if (canonical_path == e->mnt_dir) { return e->mnt_fsname; } } Loading Loading
adb/remount_service.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <string> #include <android-base/file.h> #include <android-base/properties.h> #include "adb.h" Loading @@ -36,6 +37,8 @@ #include "adb_utils.h" #include "fs_mgr.h" using android::base::Realpath; // Returns the device used to mount a directory in /proc/mounts. static std::string find_proc_mount(const char* dir) { std::unique_ptr<FILE, int(*)(FILE*)> fp(setmntent("/proc/mounts", "r"), endmntent); Loading @@ -43,9 +46,15 @@ static std::string find_proc_mount(const char* dir) { return ""; } // dir might be a symlink, e.g., /product -> /system/product in GSI. std::string canonical_path; if (!Realpath(dir, &canonical_path)) { PLOG(ERROR) << "Realpath failed: " << dir; } mntent* e; while ((e = getmntent(fp.get())) != nullptr) { if (strcmp(dir, e->mnt_dir) == 0) { if (canonical_path == e->mnt_dir) { return e->mnt_fsname; } } Loading