diff options
| author | 2017-05-03 23:54:16 +0000 | |
|---|---|---|
| committer | 2017-05-03 23:54:16 +0000 | |
| commit | 4f23dd219d43e16ccf4c96030f10c435ead9e40c (patch) | |
| tree | dadd5acbb67bbc9a4c4b010f94a1503d80246f24 | |
| parent | 0ec25acc1d59225714cae14822d75b5ddf671974 (diff) | |
| parent | 906a243b4b5ab613024d6b731fc3fb806ddbcdf0 (diff) | |
Merge "installd create_data_user_ce_path uses dir instead of symlink" am: f8af02fffa am: 21ea7683bc
am: 906a243b4b
Change-Id: I31741b3f6ead4a9468b56f779e459d76b3029537
| -rw-r--r-- | cmds/installd/utils.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index c7920821c6..7c054173b9 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -168,18 +168,19 @@ std::string create_data_app_path(const char* volume_uuid) { /** * Create the path name for user data for a certain userid. + * Keep same implementation as vold to minimize path walking overhead */ std::string create_data_user_ce_path(const char* volume_uuid, userid_t userid) { std::string data(create_data_path(volume_uuid)); - if (volume_uuid == nullptr) { - if (userid == 0) { - return StringPrintf("%s/data", data.c_str()); - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); + if (volume_uuid == nullptr && userid == 0) { + std::string legacy = StringPrintf("%s/data", data.c_str()); + struct stat sb; + if (lstat(legacy.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) { + /* /data/data is dir, return /data/data for legacy system */ + return legacy; } - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); } + return StringPrintf("%s/user/%u", data.c_str(), userid); } /** |