util-lib: introduce new empty_or_root() helper (#8746)
We check the same condition at various places. Let's add a trivial, common helper for this, and use it everywhere. It's not going to make things much faster or much shorter, but I think a lot more readable
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
12777909c9
commit
57ea45e11a
@@ -221,8 +221,7 @@ int get_user_creds_clean(
|
||||
(isempty(*shell) || is_nologin_shell(*shell)))
|
||||
*shell = NULL;
|
||||
|
||||
if (home &&
|
||||
(isempty(*home) || path_equal(*home, "/")))
|
||||
if (home && empty_or_root(*home))
|
||||
*home = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user