Merge "adb: Use a default _SC_GETPW_R_SIZE_MAX size"

This commit is contained in:
Treehugger Robot 2018-10-25 00:24:56 +00:00 committed by Gerrit Code Review
commit 9b6da16849

View file

@ -293,6 +293,9 @@ std::string adb_get_homedir_path() {
struct passwd pwent;
struct passwd* result;
int pwent_max = sysconf(_SC_GETPW_R_SIZE_MAX);
if (pwent_max == -1) {
pwent_max = 16384;
}
std::vector<char> buf(pwent_max);
int rc = getpwuid_r(getuid(), &pwent, buf.data(), buf.size(), &result);
if (rc == 0 && result) {