pre-xfer exec fails in FreeBSD

forgetful tan forgetful_tan at
Thu Feb 1 15:03:32 GMT 2007


    I want to use pre-xfer exec function in rsync for permition checking. In my Linux boxes, it successed. But today, I tried to put them in my FreeBSD box, it failed.
    I've checked the log, but found the pre-xfer exec returns always be -1, which means waitpid failed to get the return status. After doing a little ugly patch for the wait_process function as follow, pre-xfer works again.

--- main.c      Thu Feb  1 22:42:23 2007
+++ main.c.orig      Sat Oct 14 07:46:32 2006
@@ -103,10 +103,7 @@
  * remember_children(), we succeed instead of returning an error. */
 pid_t wait_process(pid_t pid, int *status_ptr, int flags)
-       pid_t waited_pid;
-       do {
-               waited_pid = waitpid(pid, status_ptr, flags);
-       } while (errno == EINTR);
+       pid_t waited_pid = waitpid(pid, status_ptr, flags);
        if (waited_pid == -1 && errno == ECHILD) {
                /* Status of requested child no longer available:  check to

    Another method that fixes the problem is to set SA_RESTART to all the signal handle functions. But I'm not sure if the above methods will bring other problems to the program. So I'm asking help here. Does anybody has a better solution ?

forgetful tan <forgetful_tan at>

More information about the rsync mailing list