=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/fargs.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/rsync/fargs.c 2019/02/10 23:24:14 1.2 --- src/usr.bin/rsync/fargs.c 2019/02/11 21:41:22 1.3 *************** *** 1,4 **** ! /* $Id: fargs.c,v 1.2 2019/02/10 23:24:14 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: fargs.c,v 1.3 2019/02/11 21:41:22 deraadt Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * *************** *** 31,40 **** size_t i = 0, j, argsz = 0; const char *rsync_path; ! assert(NULL != f); assert(f->sourcesz > 0); ! if (NULL == (rsync_path = sess->opts->rsync_path)) rsync_path = RSYNC_PATH; /* Be explicit with array size. */ --- 31,40 ---- size_t i = 0, j, argsz = 0; const char *rsync_path; ! assert(f != NULL); assert(f->sourcesz > 0); ! if ((rsync_path = sess->opts->rsync_path) == NULL) rsync_path = RSYNC_PATH; /* Be explicit with array size. */ *************** *** 47,64 **** argsz += f->sourcesz; args = calloc(argsz, sizeof(char *)); ! if (NULL == args) { ERR(sess, "calloc"); return NULL; } ! if (NULL != f->host) { ! assert(NULL != f->host); ! args[i++] = "ssh"; args[i++] = f->host; args[i++] = (char *)rsync_path; args[i++] = "--server"; ! if (FARGS_RECEIVER == f->mode) args[i++] = "--sender"; } else { args[i++] = (char *)rsync_path; --- 47,65 ---- argsz += f->sourcesz; args = calloc(argsz, sizeof(char *)); ! if (args == NULL) { ERR(sess, "calloc"); return NULL; } ! if (f->host != NULL) { ! assert(f->host != NULL); ! ! args[i++] = sess->opts->ssh ? sess->opts->ssh : "ssh"; args[i++] = f->host; args[i++] = (char *)rsync_path; args[i++] = "--server"; ! if (f->mode == FARGS_RECEIVER) args[i++] = "--sender"; } else { args[i++] = (char *)rsync_path; *************** *** 92,98 **** args[i++] = "."; ! if (FARGS_RECEIVER == f->mode) { for (j = 0; j < f->sourcesz; j++) args[i++] = f->sources[j]; } else --- 93,99 ---- args[i++] = "."; ! if (f->mode == FARGS_RECEIVER) { for (j = 0; j < f->sourcesz; j++) args[i++] = f->sources[j]; } else