basic/fd-util: drop unnecessary {}

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2024-05-30 12:07:57 +02:00
parent 1eb0009450
commit 4199866ac5
+2 -8
View File
@@ -764,8 +764,7 @@ int rearrange_stdio(int original_input_fd, int original_output_fd, int original_
}
/* Let's assemble fd[] with the fds to install in place of stdin/stdout/stderr */
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++)
if (fd[i] < 0)
fd[i] = null_fd; /* A negative parameter means: connect this one to /dev/null */
else if (fd[i] != i && fd[i] < 3) {
@@ -778,20 +777,16 @@ int rearrange_stdio(int original_input_fd, int original_output_fd, int original_
fd[i] = copy_fd[i];
}
}
/* At this point we now have the fds to use in fd[], and they are all above the stdio range, so that
* we have freedom to move them around. If the fds already were at the right places then the specific
* fds are -EBADF. Let's now move them to the right places. This is the point of no return. */
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++)
if (fd[i] == i) {
/* fd is already in place, but let's make sure O_CLOEXEC is off */
r = fd_cloexec(i, false);
if (r < 0)
goto finish;
} else {
assert(fd[i] > 2);
@@ -800,7 +795,6 @@ int rearrange_stdio(int original_input_fd, int original_output_fd, int original_
goto finish;
}
}
}
r = 0;