added --existing option, similar to one suggested by Gildas Quiniou <gildas@stip.fr>
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index a010165..f67dff0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -870,3 +870,15 @@ 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);
+}