/opt/usr/home/ can contain build artifacts like 'abuild' with no
passwd entry, causing sessiond to terminate at user->uid translation.
Fixes:
I/SESSIOND(18740): main_restore.cpp: restore_all_user_sessions(135) > Restoring last session for user abuild
E/SESSIOND(18740): main.cpp: main(46) > Exception Couldn't get Unix uid for `abuild` user - does not exist caught in top scope! Bailing out...
Change-Id: Ida7609da7a122b7f10c8ca05bf0d6b5a25e22018
* so it would be good to refactor it so as to be
* able to take either arg and avoid the syscall. */
const auto username = user_home_dir.filename();
- int uid = OS::get_uid_from_name(username.native());
+ int uid = -1;
std::string last_subsession;
try {
+ uid = OS::get_uid_from_name(username.native());
std::ifstream(get_last_subsession_path_by_user_id(uid), std::ios::in) >> last_subsession;
} catch (const std::exception &ex) {
LOGE("Could not retrieve last subsession of user %s (uid %d)", username.c_str(), uid);