pre-xfer exec fails in FreeBSD

Paul Slootman paul at
Thu Feb 1 16:07:53 GMT 2007

On Thu 01 Feb 2007, forgetful tan wrote:
>     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);

The diff is a bit bigger than necessary...
Anyway, the while should probably have been:

    } while (waited_pid < 0 && errno == EINTR);

I see that in the latest CVS version, it is (or at least the same idea).

Apart from that, if the exec always returns -1, then it's simply
failing, and removing the loop here can't make much of a difference.
So, I'm wondering whether something else is going on.
You failed to mention the rsync version, and what exactly your config is
(for amongst others the pre-xfer stuff).

Paul Slootman

More information about the rsync mailing list