]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/dbus-execute.c
strv: make iterator in STRV_FOREACH() declaread in the loop
[thirdparty/systemd.git] / src / core / dbus-execute.c
index 3967abbafb52287e3085f8d53dd7a91b314b898d..65eec8f6b7e8e0768d232871710274c2d8912cf6 100644 (file)
@@ -74,7 +74,6 @@ static int property_get_environment_files(
                 sd_bus_error *error) {
 
         ExecContext *c = userdata;
-        char **j;
         int r;
 
         assert(bus);
@@ -1138,15 +1137,12 @@ static int bus_property_get_exec_dir_symlink(
         if (r < 0)
                 return r;
 
-        for (size_t i = 0; i < d->n_items; i++) {
-                char **dst;
-
+        for (size_t i = 0; i < d->n_items; i++)
                 STRV_FOREACH(dst, d->items[i].symlinks) {
                         r = sd_bus_message_append(reply, "(sst)", d->items[i].path, *dst, 0 /* flags, unused for now */);
                         if (r < 0)
                                 return r;
                 }
-        }
 
         return sd_bus_message_close_container(reply);
 }
@@ -2016,7 +2012,6 @@ int bus_exec_context_set_transient_property(
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         _cleanup_free_ char *joined = NULL;
                         FilesystemParseFlags invert_flag = allow_list ? 0 : FILESYSTEM_PARSE_INVERT;
-                        char **s;
 
                         if (strv_isempty(l)) {
                                 c->restrict_filesystems_allow_list = false;
@@ -2062,7 +2057,6 @@ int bus_exec_context_set_transient_property(
 
         if (streq(name, "SupplementaryGroups")) {
                 _cleanup_strv_free_ char **l = NULL;
-                char **p;
 
                 r = sd_bus_message_read_strv(message, &l);
                 if (r < 0)
@@ -2427,7 +2421,6 @@ int bus_exec_context_set_transient_property(
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         _cleanup_free_ char *joined = NULL;
                         SeccompParseFlags invert_flag = allow_list ? 0 : SECCOMP_PARSE_INVERT;
-                        char **s;
 
                         if (strv_isempty(l)) {
                                 c->syscall_allow_list = false;
@@ -2512,7 +2505,6 @@ int bus_exec_context_set_transient_property(
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         _cleanup_free_ char *joined = NULL;
                         SeccompParseFlags invert_flag = allow_list ? 0 : SECCOMP_PARSE_INVERT;
-                        char **s;
 
                         if (strv_isempty(l)) {
                                 c->syscall_log_allow_list = false;
@@ -2564,9 +2556,7 @@ int bus_exec_context_set_transient_property(
 
                         if (strv_isempty(l))
                                 c->syscall_archs = set_free(c->syscall_archs);
-                        else {
-                                char **s;
-
+                        else
                                 STRV_FOREACH(s, l) {
                                         uint32_t a;
 
@@ -2579,8 +2569,6 @@ int bus_exec_context_set_transient_property(
                                                 return r;
                                 }
 
-                        }
-
                         joined = strv_join(l, " ");
                         if (!joined)
                                 return -ENOMEM;
@@ -2612,7 +2600,6 @@ int bus_exec_context_set_transient_property(
 
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         _cleanup_free_ char *joined = NULL;
-                        char **s;
 
                         if (strv_isempty(l)) {
                                 c->address_families_allow_list = allow_list;
@@ -3141,7 +3128,6 @@ int bus_exec_context_set_transient_property(
                 _cleanup_fclose_ FILE *f = NULL;
                 _cleanup_strv_free_ char **l = NULL;
                 size_t size = 0;
-                char **i;
 
                 r = sd_bus_message_enter_container(message, 'a', "(sb)");
                 if (r < 0)
@@ -3260,7 +3246,6 @@ int bus_exec_context_set_transient_property(
                               "ExtensionDirectories")) {
                 _cleanup_strv_free_ char **l = NULL;
                 char ***dirs;
-                char **p;
 
                 r = sd_bus_message_read_strv(message, &l);
                 if (r < 0)
@@ -3314,16 +3299,15 @@ int bus_exec_context_set_transient_property(
 
         } else if (streq(name, "ExecSearchPath")) {
                 _cleanup_strv_free_ char **l = NULL;
-                char **p;
 
                 r = sd_bus_message_read_strv(message, &l);
                 if (r < 0)
                         return r;
 
-                STRV_FOREACH(p, l) {
+                STRV_FOREACH(p, l)
                         if (!path_is_absolute(*p) || !path_is_normalized(*p) || strchr(*p, ':'))
                                 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name);
-                }
+
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         if (strv_isempty(l)) {
                                 c->exec_search_path = strv_free(c->exec_search_path);
@@ -3344,7 +3328,6 @@ int bus_exec_context_set_transient_property(
 
         } else if (STR_IN_SET(name, "RuntimeDirectory", "StateDirectory", "CacheDirectory", "LogsDirectory", "ConfigurationDirectory")) {
                 _cleanup_strv_free_ char **l = NULL;
-                char **p;
 
                 r = sd_bus_message_read_strv(message, &l);
                 if (r < 0)
@@ -3373,7 +3356,6 @@ int bus_exec_context_set_transient_property(
                                 unit_write_settingf(u, flags, name, "%s=", name);
                         } else {
                                 _cleanup_free_ char *joined = NULL;
-                                char **source;
 
                                 STRV_FOREACH(source, l) {
                                         r = exec_directory_add(&d->items, &d->n_items, *source, NULL);