Change-Id: Ibe5c6059b5c9edbb48a4d402eb9f0d4237e066ea
int ret = getpwuid_r (getuid (), &pw, buf, sizeof (buf), &result);
endpwent ();
- if (ret != 0 || !result)
- return String ("");
-
- if (result && pw.pw_dir) {
- home_dir = pw.pw_dir;
- } else {
+ if (ret != 0 || !result) {
LOGE ("Fail to getpwuid_r");
+ return String ("");
}
- if (!home_dir) {
+ if (pw.pw_dir)
+ home_dir = pw.pw_dir;
+ else
home_dir = getenv ("HOME");
- }
if (home_dir)
return String (home_dir);