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 bf52e65..404d49b 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 a010165..3cb80eb 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);
+}