Move the condition deciding whether the home directory should be
created as a Btrfs subvolume into a helper function, in preparation
for extending it in a following commit.
While at it, remove superfluous parentheses and an unnecessary cast.
No functional change.
Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
}
}
+#if WITH_BTRFS
+static bool
+want_btrfs_subvolume(const char *path)
+{
+ if (!subvolflg)
+ return false;
+
+ return strlen(prefix_user_home) - strlen(path) <= 1;
+}
+#endif
+
/*
* create_home - create the user's home directory
*
dir_created = false;
#if WITH_BTRFS
- if (subvolflg && (strlen(prefix_user_home) - (int)strlen(path)) <= 1) {
+ if (want_btrfs_subvolume(path)) {
char *btrfs_check = strdup(path);
struct statfs sfs;