version 1.40, 2019/03/30 23:48:24 |
version 1.41, 2019/03/31 08:47:46 |
|
|
{ |
{ |
struct opts opts; |
struct opts opts; |
pid_t child; |
pid_t child; |
int fds[2], rc, c, st, i; |
int fds[2], sd, rc, c, st, i; |
struct sess sess; |
struct sess sess; |
struct fargs *fargs; |
struct fargs *fargs; |
char **args; |
char **args; |
|
|
/* |
/* |
* If we're contacting an rsync:// daemon, then we don't need to |
* If we're contacting an rsync:// daemon, then we don't need to |
* fork, because we won't start a server ourselves. |
* fork, because we won't start a server ourselves. |
* Route directly into the socket code, in that case. |
* Route directly into the socket code, unless a remote shell |
|
* has explicitly been specified. |
*/ |
*/ |
|
|
if (fargs->remote) { |
if (fargs->remote && opts.ssh_prog == NULL) { |
assert(fargs->mode == FARGS_RECEIVER); |
assert(fargs->mode == FARGS_RECEIVER); |
exit(rsync_socket(&opts, fargs)); |
if ((rc = rsync_connect(&opts, &sd, fargs)) == 0) |
|
rc = rsync_socket(&opts, sd, fargs); |
|
exit(rc); |
} |
} |
|
|
/* Drop the dns/inet possibility. */ |
/* Drop the dns/inet possibility. */ |
|
|
memset(&sess, 0, sizeof(struct sess)); |
memset(&sess, 0, sizeof(struct sess)); |
sess.opts = &opts; |
sess.opts = &opts; |
|
|
if ((args = fargs_cmdline(&sess, fargs)) == NULL) { |
if ((args = fargs_cmdline(&sess, fargs, NULL)) == NULL) { |
ERRX1(&sess, "fargs_cmdline"); |
ERRX1(&sess, "fargs_cmdline"); |
_exit(1); |
_exit(1); |
} |
} |
|
|
/* NOTREACHED */ |
/* NOTREACHED */ |
default: |
default: |
close(fds[1]); |
close(fds[1]); |
rc = rsync_client(&opts, fds[0], fargs); |
if (!fargs->remote) |
|
rc = rsync_client(&opts, fds[0], fargs); |
|
else |
|
rc = rsync_socket(&opts, fds[0], fargs); |
break; |
break; |
} |
} |
|
|