From 4ffd4705fb917a02c814aa4dc85c3389dc95045e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 22 Sep 2020 17:31:08 +0200 Subject: [PATCH] activate: reduce scope of iterator variable --- src/activate/activate.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/activate/activate.c b/src/activate/activate.c index 5d796ab38d..bcc345bf47 100644 --- a/src/activate/activate.c +++ b/src/activate/activate.c @@ -122,7 +122,6 @@ static int open_sockets(int *epoll_fd, bool accept) { } static int exec_process(const char *name, char **argv, char **env, int start_fd, size_t n_fds) { - _cleanup_strv_free_ char **envp = NULL; _cleanup_free_ char *joined = NULL; size_t n_env = 0, length; @@ -215,15 +214,13 @@ static int exec_process(const char *name, char **argv, char **env, int start_fd, char *e; len = strv_length(arg_fdnames); - if (len == 1) { - size_t i; - - for (i = 1; i < n_fds; i++) { + if (len == 1) + for (size_t i = 1; i < n_fds; i++) { r = strv_extend(&arg_fdnames, arg_fdnames[0]); if (r < 0) - return log_error_errno(r, "Failed to extend strv: %m"); + return log_oom(); } - } else if (len != n_fds) + else if (len != n_fds) log_warning("The number of fd names is different than number of fds: %zu vs %zu", len, n_fds); names = strv_join(arg_fdnames, ":");