From d79d1c69f77dd6cc23a4692f6b8bdd82e181194e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 9 Dec 1999 06:46:11 +0000 Subject: [PATCH] fixed a bug with waitpid() - I'd forgotten about WEXITSTATUS ! --- main.c | 6 +++--- util.c | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index bf52e652..404d49b8 100644 --- 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 a0101657..3cb80eb9 100644 --- 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); +} -- 2.34.1