]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client, script: Use env_put_array()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 20 Jan 2021 18:45:11 +0000 (20:45 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 10 May 2021 06:24:44 +0000 (09:24 +0300)
src/lib-program-client/program-client-local.c
src/util/script.c

index de5b680c9d431d75ae5d720883586b7ee67dd583..ed7e9f05d46feda78f459b852b98fcfeac6633f5 100644 (file)
@@ -121,10 +121,8 @@ exec_child(const char *bin_path, const char *const *args,
 
        env_clean();
        if (array_is_created(envs)) {
-               const char *env;
-
-               array_foreach_elem(envs, env)
-                       env_put(env);
+               array_append_zero(envs);
+               env_put_array(array_front(envs));
        }
 
        /* Execute */
index 45f53ee494cf1be29d795a66f29308837c6ce07a..6ae4621dc710dab52bc30e858f99287800e0c8f3 100644 (file)
@@ -62,10 +62,8 @@ exec_child(struct master_service_connection *conn,
        array_append_zero(&exec_args);
 
        env_clean();
-       if (envs != NULL) {
-               for(; *envs != NULL; envs++)
-                       env_put(*envs);
-        }
+       if (envs != NULL)
+               env_put_array(envs);
 
        args = array_front(&exec_args);
        execvp_const(args[0], args);