From: Mike Yuan Date: Wed, 1 May 2024 09:35:04 +0000 (+0800) Subject: shared/install: reduce variable scope X-Git-Tag: v256-rc2~135^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4d733db9f7142c55b01fd33232077843e12830c;p=thirdparty%2Fsystemd.git shared/install: reduce variable scope --- diff --git a/src/shared/install.c b/src/shared/install.c index 15cab9a6127..48860c7129d 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -2857,11 +2857,12 @@ static int do_unit_file_disable( _cleanup_(install_context_done) InstallContext ctx = { .scope = scope }; _cleanup_set_free_free_ Set *remove_symlinks_to = NULL; - InstallInfo *info; bool has_install_info = false; int r; STRV_FOREACH(name, names) { + InstallInfo *info; + if (!unit_name_is_valid(*name, UNIT_NAME_ANY)) return install_changes_add(changes, n_changes, -EUCLEAN, *name, NULL); @@ -2881,7 +2882,6 @@ static int do_unit_file_disable( r = install_context_mark_for_removal(&ctx, lp, &remove_symlinks_to, config_path, changes, n_changes); if (r >= 0) r = remove_marked_symlinks(remove_symlinks_to, config_path, lp, flags & UNIT_FILE_DRY_RUN, changes, n_changes); - if (r < 0) return r;