Unverified Commit ee75dca2 by Tobin C. Harding Committed by Christian Brauner

cmd: Move assignment out of if statement

checkpatch.pl emits error ERROR: do not use assignment in if condition Move assignment out of if statement. Signed-off-by: 's avatarTobin C. Harding <me@tobin.cc>
parent 1ccfb5cd
......@@ -364,9 +364,8 @@ int main(int argc, char *argv[])
perror("pipe");
exit(EXIT_FAILURE);
}
if ((pid = fork()) == 0) {
/* Child. */
pid = fork();
if (pid == 0) { /* Child. */
close(pipe_fds1[0]);
close(pipe_fds2[1]);
opentty(ttyname0, 0);
......@@ -418,8 +417,8 @@ int main(int argc, char *argv[])
perror("write to pipe");
exit(EXIT_FAILURE);
}
if ((ret = waitpid(pid, &status, __WALL)) < 0) {
ret = waitpid(pid, &status, __WALL);
if (ret < 0) {
printf("waitpid() returns %d, errno %d\n", ret, errno);
exit(EXIT_FAILURE);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment