=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/fargs.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/rsync/fargs.c 2019/02/14 18:26:52 1.10 --- src/usr.bin/rsync/fargs.c 2019/02/14 18:31:36 1.11 *************** *** 1,4 **** ! /* $Id: fargs.c,v 1.10 2019/02/14 18:26:52 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: fargs.c,v 1.11 2019/02/14 18:31:36 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * *************** *** 30,36 **** { char **args = NULL, **new; size_t i = 0, n = 1, j, argsz = 0; ! char *rsync_path; assert(f != NULL); assert(f->sourcesz > 0); --- 30,36 ---- { char **args = NULL, **new; size_t i = 0, n = 1, j, argsz = 0; ! char *rsync_path, *ap; assert(f != NULL); assert(f->sourcesz > 0); *************** *** 54,64 **** if (f->host != NULL) { assert(f->host != NULL); ! if (sess->opts->ssh_prog) { ! char *ap = strdup(sess->opts->ssh_prog); if (ap == NULL) goto out; while ((args[i] = strsep(&ap, " \t")) != NULL) { if (args[i][0] == '\0') { ap++; /* skip seperators */ --- 54,71 ---- if (f->host != NULL) { assert(f->host != NULL); ! /* ! * Splice arguments from -e "foo bar baz" into array ! * elements required for execve(2). ! * This doesn't do anything fancy: it splits along ! * whitespace into the array. ! */ + if (sess->opts->ssh_prog) { + ap = strdup(sess->opts->ssh_prog); if (ap == NULL) goto out; + while ((args[i] = strsep(&ap, " \t")) != NULL) { if (args[i][0] == '\0') { ap++; /* skip seperators */ *************** *** 66,75 **** } /* Grow command-area of array */ if (i++ < n) continue; n += 10; ! new = reallocarray(args, argsz + n, sizeof(char *)); if (new == NULL) goto out; args = new; --- 73,84 ---- } /* Grow command-area of array */ + if (i++ < n) continue; n += 10; ! new = reallocarray(args, ! argsz + n, sizeof(char *)); if (new == NULL) goto out; args = new; *************** *** 77,82 **** --- 86,92 ---- } } else args[i++] = "ssh"; + args[i++] = f->host; args[i++] = rsync_path; args[i++] = "--server";