From: Daan De Meyer Date: Mon, 3 Feb 2025 15:17:00 +0000 (+0100) Subject: homectl: Fix empty checks X-Git-Tag: v257.3~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=950d964ee5ba32f022ccd2e8ca09c91fb0cd3e76;p=thirdparty%2Fsystemd.git homectl: Fix empty checks (cherry picked from commit 4ba3530d67d88c708c36840fbaed9935ae81faa9) --- diff --git a/src/home/homectl.c b/src/home/homectl.c index b3aacbcbcf9..2163469a509 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -2553,7 +2553,7 @@ static int create_interactively(void) { continue; }; - if (available) { + if (!strv_isempty(available)) { r = safe_atou(s, &u); if (r >= 0) { if (u <= 0 || u > strv_length(available)) { @@ -2591,7 +2591,7 @@ static int create_interactively(void) { return log_oom(); } - if (groups) { + if (!strv_isempty(groups)) { strv_sort_uniq(groups); r = sd_json_variant_set_field_strv(&arg_identity_extra, "memberOf", groups); @@ -2630,7 +2630,7 @@ static int create_interactively(void) { log_notice("Specified shell '%s' is not installed, try another one.", shell); } - if (shell) { + if (!isempty(shell)) { log_info("Selected %s as the shell for user %s", shell, username); r = sd_json_variant_set_field_string(&arg_identity_extra, "shell", shell);