fixed a bug with waitpid() - I'd forgotten about WEXITSTATUS !
authorAndrew Tridgell <tridge@samba.org>
Thu, 9 Dec 1999 06:46:11 +0000 (06:46 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 9 Dec 1999 06:46:11 +0000 (06:46 +0000)
main.c
util.c

diff --git a/main.c b/main.c
index bf52e6522980c020904ffd73a0aaec5fb17e1278..404d49b80f7c6b029923990808f14d635cb25458 100644 (file)
--- a/main.c
+++ b/main.c
@@ -310,7 +310,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
        generate_files(f_out,flist,local_name,recv_pipe[0]);
 
        io_flush();
-       waitpid(pid, &status, 0);
+       wait_process(pid, &status);
        return status;
 }
 
@@ -406,7 +406,7 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
                        if (verbose > 3)
                                rprintf(FINFO,"client_run waiting on %d\n",pid);
                        io_flush();
-                       waitpid(pid, &status, 0);
+                       wait_process(pid, &status);
                }
                report(-1);
                exit_cleanup(status);
@@ -430,7 +430,7 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[])
                if (verbose > 3)
                        rprintf(FINFO,"client_run2 waiting on %d\n",pid);
                io_flush();
-               waitpid(pid, &status, 0);
+               wait_process(pid, &status);
        }
        
        return status | status2;
diff --git a/util.c b/util.c
index a010165727a95bbe4e8b5306f731e62857c0fb55..3cb80eb9d1c17c324f176b7830d4c186d0fda55f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -870,3 +870,12 @@ char *timestring(time_t t)
        return(TimeBuf);
 }
 
+
+/****************************************************************************
+ like waitpid but does the WEXITSTATUS
+****************************************************************************/
+void wait_process(pid_t pid, int *status)
+{
+       waitpid(pid, status, 0);
+       *status = WEXITSTATUS(*status);
+}