From f0a86c6d1c8288870a5e1c05cc12459ef356c3df Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 16 Aug 2018 17:04:58 +1000 Subject: [PATCH] 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: Tobin C. Harding --- src/lxc/cmd/lxc_usernsexec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lxc/cmd/lxc_usernsexec.c b/src/lxc/cmd/lxc_usernsexec.c index 268ec9341..69ba7a41e 100644 --- a/src/lxc/cmd/lxc_usernsexec.c +++ b/src/lxc/cmd/lxc_usernsexec.c @@ -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); @@ -413,8 +412,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); } -- 2.47.2