Skip to content

Commit 4ffd470

Browse files
committed
activate: reduce scope of iterator variable
1 parent 89de370 commit 4ffd470

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/activate/activate.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ static int open_sockets(int *epoll_fd, bool accept) {
122122
}
123123

124124
static int exec_process(const char *name, char **argv, char **env, int start_fd, size_t n_fds) {
125-
126125
_cleanup_strv_free_ char **envp = NULL;
127126
_cleanup_free_ char *joined = NULL;
128127
size_t n_env = 0, length;
@@ -215,15 +214,13 @@ static int exec_process(const char *name, char **argv, char **env, int start_fd,
215214
char *e;
216215

217216
len = strv_length(arg_fdnames);
218-
if (len == 1) {
219-
size_t i;
220-
221-
for (i = 1; i < n_fds; i++) {
217+
if (len == 1)
218+
for (size_t i = 1; i < n_fds; i++) {
222219
r = strv_extend(&arg_fdnames, arg_fdnames[0]);
223220
if (r < 0)
224-
return log_error_errno(r, "Failed to extend strv: %m");
221+
return log_oom();
225222
}
226-
} else if (len != n_fds)
223+
else if (len != n_fds)
227224
log_warning("The number of fd names is different than number of fds: %zu vs %zu", len, n_fds);
228225

229226
names = strv_join(arg_fdnames, ":");

0 commit comments

Comments
 (0)