summaryrefslogtreecommitdiffstats
path: root/src/basic/user-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-04-18 14:20:49 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-04-18 14:20:49 +0200
commit57ea45e11a3856a110cf195628f8b26cfe019a15 (patch)
tree900a35ca836367027c812d0829bf7cf2f508e9b1 /src/basic/user-util.c
parentMerge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_p... (diff)
downloadsystemd-57ea45e11a3856a110cf195628f8b26cfe019a15.tar.xz
systemd-57ea45e11a3856a110cf195628f8b26cfe019a15.zip
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
Diffstat (limited to 'src/basic/user-util.c')
-rw-r--r--src/basic/user-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 66a01b0cfd..1effd55b02 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -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;