Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed error message for incompatible 2.6.4 pre-release versions.
[rsync/rsync.git]
/
batch.c
diff --git
a/batch.c
b/batch.c
index
efc38c3
..
44d2c98
100644
(file)
--- a/
batch.c
+++ b/
batch.c
@@
-23,17
+23,14
@@
extern char *batch_name;
extern struct filter_list_struct filter_list;
extern struct filter_list_struct filter_list;
-static int fudged_recurse;
-
static int *flag_ptr[] = {
static int *flag_ptr[] = {
- &
fudged_
recurse,
+ &recurse,
&preserve_uid,
&preserve_gid,
&preserve_links,
&preserve_devices,
&preserve_hard_links,
&always_checksum,
&preserve_uid,
&preserve_gid,
&preserve_links,
&preserve_devices,
&preserve_hard_links,
&always_checksum,
- &xfer_dirs,
NULL
};
NULL
};
@@
-55,7
+52,6
@@
void write_stream_flags(int fd)
/* Start the batch file with a bitmap of data-stream-affecting
* flags. */
/* Start the batch file with a bitmap of data-stream-affecting
* flags. */
- fudged_recurse = recurse < 0;
for (i = 0, flags = 0; flag_ptr[i]; i++) {
if (*flag_ptr[i])
flags |= 1 << i;
for (i = 0, flags = 0; flag_ptr[i]; i++) {
if (*flag_ptr[i])
flags |= 1 << i;
@@
-67,7
+63,6
@@
void read_stream_flags(int fd)
{
int i, flags;
{
int i, flags;
- fudged_recurse = recurse < 0;
if (protocol_version < 29)
xfer_dirs = 0;
for (i = 0, flags = read_int(fd); flag_ptr[i]; i++) {
if (protocol_version < 29)
xfer_dirs = 0;
for (i = 0, flags = read_int(fd); flag_ptr[i]; i++) {
@@
-81,7
+76,6
@@
void read_stream_flags(int fd)
*flag_ptr[i] = set;
}
}
*flag_ptr[i] = set;
}
}
- recurse = fudged_recurse ? -1 : 0;
if (protocol_version < 29)
xfer_dirs = recurse ? 1 : 0;
}
if (protocol_version < 29)
xfer_dirs = recurse ? 1 : 0;
}
@@
-116,7
+110,7
@@
static void write_filter_rules(int fd)
write_sbuf(fd, " <<'#E#'\n");
for (ent = filter_list.head; ent; ent = ent->next) {
unsigned int plen;
write_sbuf(fd, " <<'#E#'\n");
for (ent = filter_list.head; ent; ent = ent->next) {
unsigned int plen;
- char *p = get_rule_prefix(ent->match_flags, "- ", &plen);
+ char *p = get_rule_prefix(ent->match_flags, "- ",
0,
&plen);
write_buf(fd, p, plen);
write_sbuf(fd, ent->pattern);
if (ent->match_flags & MATCHFLG_DIRECTORY)
write_buf(fd, p, plen);
write_sbuf(fd, ent->pattern);
if (ent->match_flags & MATCHFLG_DIRECTORY)
@@
-143,7
+137,8
@@
void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IEXEC);
if (fd < 0) {
fd = do_open(filename, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IEXEC);
if (fd < 0) {
- rsyserr(FERROR, errno, "Batch file %s open error", filename);
+ rsyserr(FERROR, errno, "Batch file %s open error",
+ safe_fname(filename));
exit_cleanup(1);
}
exit_cleanup(1);
}
@@
-179,10
+174,7
@@
void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
} else
write_arg(fd, p);
}
} else
write_arg(fd, p);
}
- if ((p = find_colon(argv[argc - 1])) != NULL) {
- if (*++p == ':')
- p++;
- } else
+ if (!(p = check_for_hostspec(argv[argc - 1], &p, &i)))
p = argv[argc - 1];
write(fd, " ${1:-", 6);
write_arg(fd, p);
p = argv[argc - 1];
write(fd, " ${1:-", 6);
write_arg(fd, p);
@@
-190,7
+182,8
@@
void write_batch_shell_file(int argc, char *argv[], int file_arg_cnt)
if (filter_list.head)
write_filter_rules(fd);
if (write(fd, "\n", 1) != 1 || close(fd) < 0) {
if (filter_list.head)
write_filter_rules(fd);
if (write(fd, "\n", 1) != 1 || close(fd) < 0) {
- rsyserr(FERROR, errno, "Batch file %s write error", filename);
+ rsyserr(FERROR, errno, "Batch file %s write error",
+ safe_fname(filename));
exit_cleanup(1);
}
}
exit_cleanup(1);
}
}
@@
-207,25
+200,25
@@
void show_flist(int index, struct file_struct **fptr)
rprintf(FINFO, "flist->length=%.0f\n",
(double) fptr[i]->length);
rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
rprintf(FINFO, "flist->length=%.0f\n",
(double) fptr[i]->length);
rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
- rprintf(FINFO, "flist->basename=%s\n", fptr[i]->basename);
- if (fptr[i]->dirname)
+ rprintf(FINFO, "flist->basename=%s\n",
+ safe_fname(fptr[i]->basename));
+ if (fptr[i]->dirname) {
rprintf(FINFO, "flist->dirname=%s\n",
rprintf(FINFO, "flist->dirname=%s\n",
- fptr[i]->dirname);
- if (am_sender && fptr[i]->dir.root)
+ safe_fname(fptr[i]->dirname));
+ }
+ if (am_sender && fptr[i]->dir.root) {
rprintf(FINFO, "flist->dir.root=%s\n",
rprintf(FINFO, "flist->dir.root=%s\n",
- fptr[i]->dir.root);
+ safe_fname(fptr[i]->dir.root));
+ }
}
}
}
}
+/* for debugging */
void show_argvs(int argc, char *argv[])
{
void show_argvs(int argc, char *argv[])
{
- /* for debugging * */
-
int i;
int i;
- rprintf(FINFO, "BATCH.C:show_argvs,argc=%d\n", argc);
- for (i = 0; i < argc; i++) {
- /* if (argv[i]) */
- rprintf(FINFO, "i=%d,argv[i]=%s\n", i, argv[i]);
- }
+ rprintf(FINFO, "BATCH.C:show_argvs,argc=%d\n", argc);
+ for (i = 0; i < argc; i++)
+ rprintf(FINFO, "i=%d,argv[i]=%s\n", i, safe_fname(argv[i]));
}
}