diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index a0e72f2de4..9151176fca 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -224,18 +224,24 @@ String Account::generate_shadow_file() const if (p->sp_namp == m_username) { builder.appendff("{}:{}:{}:{}:{}:{}:{}:{}:{}\n", m_username, m_password_hash, - p->sp_lstchg, p->sp_min, - p->sp_max, p->sp_warn, - p->sp_inact, p->sp_expire, - p->sp_flag); + (p->sp_lstchg == -1) ? "" : String::formatted("{}", p->sp_lstchg), + (p->sp_min == -1) ? "" : String::formatted("{}", p->sp_min), + (p->sp_max == -1) ? "" : String::formatted("{}", p->sp_max), + (p->sp_warn == -1) ? "" : String::formatted("{}", p->sp_warn), + (p->sp_inact == -1) ? "" : String::formatted("{}", p->sp_inact), + (p->sp_expire == -1) ? "" : String::formatted("{}", p->sp_expire), + (p->sp_flag == 0) ? "" : String::formatted("{}", p->sp_flag)); } else { builder.appendff("{}:{}:{}:{}:{}:{}:{}:{}:{}\n", p->sp_namp, p->sp_pwdp, - p->sp_lstchg, p->sp_min, - p->sp_max, p->sp_warn, - p->sp_inact, p->sp_expire, - p->sp_flag); + (p->sp_lstchg == -1) ? "" : String::formatted("{}", p->sp_lstchg), + (p->sp_min == -1) ? "" : String::formatted("{}", p->sp_min), + (p->sp_max == -1) ? "" : String::formatted("{}", p->sp_max), + (p->sp_warn == -1) ? "" : String::formatted("{}", p->sp_warn), + (p->sp_inact == -1) ? "" : String::formatted("{}", p->sp_inact), + (p->sp_expire == -1) ? "" : String::formatted("{}", p->sp_expire), + (p->sp_flag == 0) ? "" : String::formatted("{}", p->sp_flag)); } } endspent();