Check for 'status' and not return value of waitpid() function
authorPavan Deolasee <[email protected]>
Tue, 12 Apr 2016 12:53:52 +0000 (18:23 +0530)
committerPavan Deolasee <[email protected]>
Tue, 12 Apr 2016 12:53:52 +0000 (18:23 +0530)
contrib/pgxc_ctl/do_shell.c

index 8c112651fca67e70706aa0deb0012c23ffbc8ba5..5165ef3564ad241ecfdb34b000d83f123c7780e0 100644 (file)
@@ -467,10 +467,9 @@ int doCmdList(cmdList_t *cmds)
                        {
                                if (cmds->cmds[ii]->pid)
                                {
-                                       int rc_new;
-                                       
-                                       rc_new = waitpid(cmds->cmds[ii]->pid, &status, 0);
-                                       rc = WEXITSTATUS(rc_new);
+                                       int pid;
+                                       pid = waitpid(cmds->cmds[ii]->pid, &status, 0);
+                                       rc = WEXITSTATUS(status);
                                }
                        }
                        cmds->cmds[ii]->pid = 0;