diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-08-16 08:34:18 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-08-16 08:34:18 +0000 |
commit | 82980a23840452c069c37dd7c99c3ac937536847 (patch) | |
tree | a20a3de26146eddf5a3354342194e2d038b59f7b | |
parent | b6a30afc9812ddf685caf7d06dcf102e9e8073e9 (diff) | |
download | rsync-82980a23840452c069c37dd7c99c3ac937536847.tar.gz |
fixed timing problem with cleanup and io_flush() by using non-blocking
waitpid()
-rw-r--r-- | main.c | 13 | ||||
-rw-r--r-- | rsync.h | 4 | ||||
-rw-r--r-- | util.c | 14 |
3 files changed, 17 insertions, 14 deletions
@@ -25,6 +25,19 @@ struct stats stats; extern int verbose; + +/**************************************************************************** +wait for a process to exit, calling io_flush while waiting +****************************************************************************/ +void wait_process(pid_t pid, int *status) +{ + while (waitpid(pid, status, WNOHANG) == 0) { + sleep(1); + io_flush(); + } + *status = WEXITSTATUS(*status); +} + static void report(int f) { time_t t = time(NULL); @@ -510,4 +510,8 @@ size_t strlcpy(char *d, const char *s, size_t bufsize); size_t strlcat(char *d, const char *s, size_t bufsize); #endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF)) +#endif + #define exit_cleanup(code) _exit_cleanup(code, __FILE__, __LINE__) @@ -929,20 +929,6 @@ char *timestring(time_t t) return(TimeBuf); } - -/**************************************************************************** - like waitpid but does the WEXITSTATUS -****************************************************************************/ -#ifndef WEXITSTATUS -#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF)) -#endif -void wait_process(pid_t pid, int *status) -{ - waitpid(pid, status, 0); - *status = WEXITSTATUS(*status); -} - - #ifdef __INSURE__ #include <dlfcn.h> |