From: Wayne Davison Date: Mon, 19 Jul 2004 00:53:49 +0000 (+0000) Subject: Fixed the argv munging to work properly regardless of whether the X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/b462781fd06838f95aa26ca7e868c87809483f05 Fixed the argv munging to work properly regardless of whether the user specified a trailing '=VALUE' or put the value in a separate arg. --- diff --git a/batch.c b/batch.c index 5373a484..8d3f7961 100644 --- a/batch.c +++ b/batch.c @@ -16,7 +16,7 @@ void write_batch_argvs_file(int argc, char *argv[]) char filename[MAXPATHLEN]; stringjoin(filename, sizeof filename, - batch_name, ".rsync_argvs", NULL); + batch_name, ".sh", NULL); fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IEXEC); if (fd < 0) { @@ -28,13 +28,16 @@ void write_batch_argvs_file(int argc, char *argv[]) for (i = 0; i < argc; i++) { if (i == argc - 2) /* Skip source directory on cmdline */ continue; - if (strncmp(argv[i], "--files-from=", 13) == 0) + if (strncmp(argv[i], "--files-from", 12) == 0) { + if (strchr(argv[i], '=') == NULL) + i++; continue; + } if (i != 0) write(fd, " ", 1); - if (strncmp(argv[i], "--write-batch=", 14) == 0) { - write(fd, "--read-batch=", 13); - write(fd, batch_name, strlen(batch_name)); + if (strncmp(argv[i], "--write-batch", 13) == 0) { + write(fd, "--read", 6); + write(fd, argv[i] + 7, strlen(argv[i] + 7)); } else if (i == argc - 1) { char *p = find_colon(argv[i]); if (p) {