Use the latest F_*() accessors.
This commit is contained in:
63
generator.c
63
generator.c
@@ -50,7 +50,6 @@ extern int delete_during;
|
|||||||
extern int delete_after;
|
extern int delete_after;
|
||||||
extern int module_id;
|
extern int module_id;
|
||||||
extern int ignore_errors;
|
extern int ignore_errors;
|
||||||
extern int flist_extra_ndx;
|
|
||||||
extern int remove_source_files;
|
extern int remove_source_files;
|
||||||
extern int delay_updates;
|
extern int delay_updates;
|
||||||
extern int update_only;
|
extern int update_only;
|
||||||
@@ -86,7 +85,6 @@ extern long block_size; /* "long" because popt can't set an int32. */
|
|||||||
extern int max_delete;
|
extern int max_delete;
|
||||||
extern int force_delete;
|
extern int force_delete;
|
||||||
extern int one_file_system;
|
extern int one_file_system;
|
||||||
extern int file_struct_len;
|
|
||||||
extern struct stats stats;
|
extern struct stats stats;
|
||||||
extern dev_t filesystem_dev;
|
extern dev_t filesystem_dev;
|
||||||
extern char *backup_dir;
|
extern char *backup_dir;
|
||||||
@@ -246,7 +244,7 @@ static enum delret delete_dir_contents(char *fname, int flags)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(p, fp->basename, remainder);
|
strlcpy(p, F_BASENAME(fp), remainder);
|
||||||
/* Save stack by recursing to ourself directly. */
|
/* Save stack by recursing to ourself directly. */
|
||||||
if (S_ISDIR(fp->mode)
|
if (S_ISDIR(fp->mode)
|
||||||
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
|
&& delete_dir_contents(fname, flags | DEL_RECURSE) != DR_SUCCESS)
|
||||||
@@ -393,7 +391,7 @@ static void delete_in_dir(struct file_list *flist, char *fbuf,
|
|||||||
* from the filesystem. */
|
* from the filesystem. */
|
||||||
for (i = dirlist->count; i--; ) {
|
for (i = dirlist->count; i--; ) {
|
||||||
struct file_struct *fp = dirlist->files[i];
|
struct file_struct *fp = dirlist->files[i];
|
||||||
if (!fp->basename)
|
if (!F_IS_ACTIVE(fp))
|
||||||
continue;
|
continue;
|
||||||
if (fp->flags & FLAG_MOUNT_DIR) {
|
if (fp->flags & FLAG_MOUNT_DIR) {
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
@@ -470,7 +468,7 @@ void itemize(struct file_struct *file, int ndx, int statret, STRUCT_STAT *st,
|
|||||||
: S_ISDIR(file->mode) ? !omit_dir_times
|
: S_ISDIR(file->mode) ? !omit_dir_times
|
||||||
: !S_ISLNK(file->mode);
|
: !S_ISLNK(file->mode);
|
||||||
|
|
||||||
if (S_ISREG(file->mode) && file->length != st->st_size)
|
if (S_ISREG(file->mode) && F_LENGTH(file) != st->st_size)
|
||||||
iflags |= ITEM_REPORT_SIZE;
|
iflags |= ITEM_REPORT_SIZE;
|
||||||
if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
|
if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
|
||||||
&& !(iflags & ITEM_MATCHED)
|
&& !(iflags & ITEM_MATCHED)
|
||||||
@@ -509,7 +507,7 @@ void itemize(struct file_struct *file, int ndx, int statret, STRUCT_STAT *st,
|
|||||||
/* Perform our quick-check heuristic for determining if a file is unchanged. */
|
/* Perform our quick-check heuristic for determining if a file is unchanged. */
|
||||||
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
|
int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
|
||||||
{
|
{
|
||||||
if (st->st_size != file->length)
|
if (st->st_size != F_LENGTH(file))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* if always checksum is set then we use the checksum instead
|
/* if always checksum is set then we use the checksum instead
|
||||||
@@ -666,7 +664,7 @@ static void generate_and_send_sums(int fd, OFF_T len, int f_out, int f_copy)
|
|||||||
static int find_fuzzy(struct file_struct *file, struct file_list *dirlist)
|
static int find_fuzzy(struct file_struct *file, struct file_list *dirlist)
|
||||||
{
|
{
|
||||||
int fname_len, fname_suf_len;
|
int fname_len, fname_suf_len;
|
||||||
const char *fname_suf, *fname = file->basename;
|
const char *fname_suf, *fname = F_BASENAME(file);
|
||||||
uint32 lowest_dist = 25 << 16; /* ignore a distance greater than 25 */
|
uint32 lowest_dist = 25 << 16; /* ignore a distance greater than 25 */
|
||||||
int j, lowest_j = -1;
|
int j, lowest_j = -1;
|
||||||
|
|
||||||
@@ -679,12 +677,12 @@ static int find_fuzzy(struct file_struct *file, struct file_list *dirlist)
|
|||||||
int len, suf_len;
|
int len, suf_len;
|
||||||
uint32 dist;
|
uint32 dist;
|
||||||
|
|
||||||
if (!S_ISREG(fp->mode) || !fp->length || fp->flags & FLAG_SENT)
|
if (!S_ISREG(fp->mode) || !F_LENGTH(fp) || fp->flags & FLAG_SENT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
name = fp->basename;
|
name = F_BASENAME(fp);
|
||||||
|
|
||||||
if (fp->length == file->length
|
if (F_LENGTH(fp) == F_LENGTH(file)
|
||||||
&& cmp_time(fp->modtime, file->modtime) == 0) {
|
&& cmp_time(fp->modtime, file->modtime) == 0) {
|
||||||
if (verbose > 4) {
|
if (verbose > 4) {
|
||||||
rprintf(FINFO,
|
rprintf(FINFO,
|
||||||
@@ -724,7 +722,7 @@ void check_for_finished_hlinks(int itemizing, enum logcode code)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
file = the_file_list->files[ndx];
|
file = the_file_list->files[ndx];
|
||||||
if (!IS_HLINKED(file))
|
if (!F_IS_HLINKED(file))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
@@ -787,7 +785,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
|||||||
if (hard_link_one(file, ndx, fname, 0, stp,
|
if (hard_link_one(file, ndx, fname, 0, stp,
|
||||||
cmpbuf, 1, i, code) < 0)
|
cmpbuf, 1, i, code) < 0)
|
||||||
goto try_a_copy;
|
goto try_a_copy;
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, j);
|
hard_link_cluster(file, ndx, itemizing, code, j);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@@ -818,7 +816,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
|||||||
rprintf(code, "%s%s\n", fname,
|
rprintf(code, "%s%s\n", fname,
|
||||||
match_level == 3 ? " is uptodate" : "");
|
match_level == 3 ? " is uptodate" : "");
|
||||||
}
|
}
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, j);
|
hard_link_cluster(file, ndx, itemizing, code, j);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -943,7 +941,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
|
|||||||
cmpbuf, fname);
|
cmpbuf, fname);
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@@ -1157,7 +1155,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preserve_hard_links && IS_HLINKED(file)
|
if (preserve_hard_links && F_IS_HLINKED(file)
|
||||||
&& hard_link_check(file, ndx, fname, statret, &st,
|
&& hard_link_check(file, ndx, fname, statret, &st,
|
||||||
itemizing, code, HL_CHECK_MASTER))
|
itemizing, code, HL_CHECK_MASTER))
|
||||||
return;
|
return;
|
||||||
@@ -1187,7 +1185,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
if (itemizing)
|
if (itemizing)
|
||||||
itemize(file, ndx, 0, &st, 0, 0, NULL);
|
itemize(file, ndx, 0, &st, 0, 0, NULL);
|
||||||
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
if (remove_source_files == 1)
|
if (remove_source_files == 1)
|
||||||
goto return_with_success;
|
goto return_with_success;
|
||||||
@@ -1213,7 +1211,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
} else if (j >= 0)
|
} else if (j >= 0)
|
||||||
statret = 1;
|
statret = 1;
|
||||||
}
|
}
|
||||||
if (preserve_hard_links && IS_HLINKED(file)
|
if (preserve_hard_links && F_IS_HLINKED(file)
|
||||||
&& hard_link_check(file, ndx, fname, -1, &st,
|
&& hard_link_check(file, ndx, fname, -1, &st,
|
||||||
itemizing, code, HL_SKIP))
|
itemizing, code, HL_SKIP))
|
||||||
return;
|
return;
|
||||||
@@ -1228,7 +1226,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
}
|
}
|
||||||
if (code != FNONE && verbose)
|
if (code != FNONE && verbose)
|
||||||
rprintf(code, "%s -> %s\n", fname, sl);
|
rprintf(code, "%s -> %s\n", fname, sl);
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
/* This does not check remove_source_files == 1
|
/* This does not check remove_source_files == 1
|
||||||
* because this is one of the items that the old
|
* because this is one of the items that the old
|
||||||
@@ -1261,7 +1259,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
if (itemizing)
|
if (itemizing)
|
||||||
itemize(file, ndx, 0, &st, 0, 0, NULL);
|
itemize(file, ndx, 0, &st, 0, 0, NULL);
|
||||||
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
if (remove_source_files == 1)
|
if (remove_source_files == 1)
|
||||||
goto return_with_success;
|
goto return_with_success;
|
||||||
@@ -1285,7 +1283,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
} else if (j >= 0)
|
} else if (j >= 0)
|
||||||
statret = 1;
|
statret = 1;
|
||||||
}
|
}
|
||||||
if (preserve_hard_links && IS_HLINKED(file)
|
if (preserve_hard_links && F_IS_HLINKED(file)
|
||||||
&& hard_link_check(file, ndx, fname, -1, &st,
|
&& hard_link_check(file, ndx, fname, -1, &st,
|
||||||
itemizing, code, HL_SKIP))
|
itemizing, code, HL_SKIP))
|
||||||
return;
|
return;
|
||||||
@@ -1304,7 +1302,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
}
|
}
|
||||||
if (code != FNONE && verbose)
|
if (code != FNONE && verbose)
|
||||||
rprintf(code, "%s\n", fname);
|
rprintf(code, "%s\n", fname);
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
if (remove_source_files == 1)
|
if (remove_source_files == 1)
|
||||||
goto return_with_success;
|
goto return_with_success;
|
||||||
@@ -1319,7 +1317,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_size && file->length > max_size) {
|
if (max_size && F_LENGTH(file) > max_size) {
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
if (the_file_list->count == 1)
|
if (the_file_list->count == 1)
|
||||||
fname = f_name(file, NULL);
|
fname = f_name(file, NULL);
|
||||||
@@ -1327,7 +1325,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (min_size && file->length < min_size) {
|
if (min_size && F_LENGTH(file) < min_size) {
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
if (the_file_list->count == 1)
|
if (the_file_list->count == 1)
|
||||||
fname = f_name(file, NULL);
|
fname = f_name(file, NULL);
|
||||||
@@ -1394,7 +1392,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
|
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
|
||||||
fname, fnamecmpbuf);
|
fname, fnamecmpbuf);
|
||||||
}
|
}
|
||||||
st.st_size = fuzzy_file->length;
|
st.st_size = F_LENGTH(fuzzy_file);
|
||||||
statret = 0;
|
statret = 0;
|
||||||
fnamecmp = fnamecmpbuf;
|
fnamecmp = fnamecmpbuf;
|
||||||
fnamecmp_type = FNAMECMP_FUZZY;
|
fnamecmp_type = FNAMECMP_FUZZY;
|
||||||
@@ -1402,7 +1400,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (statret != 0) {
|
if (statret != 0) {
|
||||||
if (preserve_hard_links && IS_HLINKED(file)
|
if (preserve_hard_links && F_IS_HLINKED(file)
|
||||||
&& hard_link_check(file, ndx, fname, statret, &st,
|
&& hard_link_check(file, ndx, fname, statret, &st,
|
||||||
itemizing, code, HL_SKIP))
|
itemizing, code, HL_SKIP))
|
||||||
return;
|
return;
|
||||||
@@ -1413,7 +1411,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (append_mode && st.st_size > file->length)
|
if (append_mode && st.st_size > F_LENGTH(file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
|
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
|
||||||
@@ -1430,7 +1428,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
0, 0, NULL);
|
0, 0, NULL);
|
||||||
}
|
}
|
||||||
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
if (remove_source_files != 1)
|
if (remove_source_files != 1)
|
||||||
return;
|
return;
|
||||||
@@ -1465,7 +1463,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
full_fname(fnamecmp));
|
full_fname(fnamecmp));
|
||||||
pretend_missing:
|
pretend_missing:
|
||||||
/* pretend the file didn't exist */
|
/* pretend the file didn't exist */
|
||||||
if (preserve_hard_links && IS_HLINKED(file)
|
if (preserve_hard_links && F_IS_HLINKED(file)
|
||||||
&& hard_link_check(file, ndx, fname, statret, &st,
|
&& hard_link_check(file, ndx, fname, statret, &st,
|
||||||
itemizing, code, HL_SKIP))
|
itemizing, code, HL_SKIP))
|
||||||
return;
|
return;
|
||||||
@@ -1521,11 +1519,11 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|||||||
if (fnamecmp_type == FNAMECMP_FUZZY)
|
if (fnamecmp_type == FNAMECMP_FUZZY)
|
||||||
iflags |= ITEM_XNAME_FOLLOWS;
|
iflags |= ITEM_XNAME_FOLLOWS;
|
||||||
itemize(file, -1, real_ret, &real_st, iflags, fnamecmp_type,
|
itemize(file, -1, real_ret, &real_st, iflags, fnamecmp_type,
|
||||||
fuzzy_file ? fuzzy_file->basename : NULL);
|
fuzzy_file ? F_BASENAME(fuzzy_file) : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!do_xfers) {
|
if (!do_xfers) {
|
||||||
if (preserve_hard_links && IS_HLINKED(file))
|
if (preserve_hard_links && F_IS_HLINKED(file))
|
||||||
hard_link_cluster(file, ndx, itemizing, code, -1);
|
hard_link_cluster(file, ndx, itemizing, code, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1614,7 +1612,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name)
|
|||||||
for (i = 0; i < flist->count; i++) {
|
for (i = 0; i < flist->count; i++) {
|
||||||
struct file_struct *file = flist->files[i];
|
struct file_struct *file = flist->files[i];
|
||||||
|
|
||||||
if (!file->basename)
|
if (!F_IS_ACTIVE(file))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (local_name)
|
if (local_name)
|
||||||
@@ -1718,8 +1716,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name)
|
|||||||
* modified-time values. */
|
* modified-time values. */
|
||||||
for (i = 0; i < flist->count; i++) {
|
for (i = 0; i < flist->count; i++) {
|
||||||
struct file_struct *file = flist->files[i];
|
struct file_struct *file = flist->files[i];
|
||||||
|
if (!F_IS_ACTIVE(file) || !S_ISDIR(file->mode))
|
||||||
if (!file->basename || !S_ISDIR(file->mode))
|
|
||||||
continue;
|
continue;
|
||||||
if (!need_retouch_dir_times && file->mode & S_IWUSR)
|
if (!need_retouch_dir_times && file->mode & S_IWUSR)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
5
hlink.c
5
hlink.c
@@ -28,7 +28,6 @@ extern int dry_run;
|
|||||||
extern int do_xfers;
|
extern int do_xfers;
|
||||||
extern int link_dest;
|
extern int link_dest;
|
||||||
extern int make_backups;
|
extern int make_backups;
|
||||||
extern int flist_extra_ndx;
|
|
||||||
extern int remove_source_files;
|
extern int remove_source_files;
|
||||||
extern int stdout_format_has_i;
|
extern int stdout_format_has_i;
|
||||||
extern char *basis_dir[];
|
extern char *basis_dir[];
|
||||||
@@ -106,7 +105,7 @@ static void link_idev_data(void)
|
|||||||
file->flags |= FLAG_HLINK_LAST;
|
file->flags |= FLAG_HLINK_LAST;
|
||||||
F_HLIST(file) = hl;
|
F_HLIST(file) = hl;
|
||||||
} else
|
} else
|
||||||
file->flags &= ~FLAG_HLINK_INFO;
|
file->flags &= ~FLAG_HLINKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!to) {
|
if (!to) {
|
||||||
@@ -138,7 +137,7 @@ void init_hard_links(void)
|
|||||||
|
|
||||||
hlink_count = 0;
|
hlink_count = 0;
|
||||||
for (i = 0; i < the_file_list->count; i++) {
|
for (i = 0; i < the_file_list->count; i++) {
|
||||||
if (IS_HLINKED(FPTR(i)))
|
if (F_IS_HLINKED(FPTR(i)))
|
||||||
hlink_list[hlink_count++] = i;
|
hlink_list[hlink_count++] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
io.c
4
io.c
@@ -342,13 +342,13 @@ void increment_active_files(int ndx, int itemizing, enum logcode code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
active_filecnt++;
|
active_filecnt++;
|
||||||
active_bytecnt += the_file_list->files[ndx]->length;
|
active_bytecnt += F_LENGTH(the_file_list->files[ndx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void decrement_active_files(int ndx)
|
void decrement_active_files(int ndx)
|
||||||
{
|
{
|
||||||
active_filecnt--;
|
active_filecnt--;
|
||||||
active_bytecnt -= the_file_list->files[ndx]->length;
|
active_bytecnt -= F_LENGTH(the_file_list->files[ndx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to push messages off the list onto the wire. If we leave with more
|
/* Try to push messages off the list onto the wire. If we leave with more
|
||||||
|
|||||||
40
log.c
40
log.c
@@ -39,8 +39,6 @@ extern int protocol_version;
|
|||||||
extern int preserve_times;
|
extern int preserve_times;
|
||||||
extern int preserve_uid;
|
extern int preserve_uid;
|
||||||
extern int preserve_gid;
|
extern int preserve_gid;
|
||||||
extern int flist_extra_ndx;
|
|
||||||
extern int file_struct_len;
|
|
||||||
extern int stdout_format_has_i;
|
extern int stdout_format_has_i;
|
||||||
extern int stdout_format_has_o_or_i;
|
extern int stdout_format_has_o_or_i;
|
||||||
extern int logfile_format_has_i;
|
extern int logfile_format_has_i;
|
||||||
@@ -427,8 +425,9 @@ void rflush(enum logcode code)
|
|||||||
|
|
||||||
/* A generic logging routine for send/recv, with parameter substitiution. */
|
/* A generic logging routine for send/recv, with parameter substitiution. */
|
||||||
static void log_formatted(enum logcode code, const char *format, const char *op,
|
static void log_formatted(enum logcode code, const char *format, const char *op,
|
||||||
struct file_struct *file, struct stats *initial_stats,
|
struct file_struct *file, const char *fname,
|
||||||
int iflags, const char *hlink)
|
struct stats *initial_stats, int iflags,
|
||||||
|
const char *hlink)
|
||||||
{
|
{
|
||||||
char buf[MAXPATHLEN+1024], buf2[MAXPATHLEN], fmt[32];
|
char buf[MAXPATHLEN+1024], buf2[MAXPATHLEN], fmt[32];
|
||||||
char *p, *s, *c;
|
char *p, *s, *c;
|
||||||
@@ -473,7 +472,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
|
|||||||
case 'l':
|
case 'l':
|
||||||
strlcat(fmt, ".0f", sizeof fmt);
|
strlcat(fmt, ".0f", sizeof fmt);
|
||||||
snprintf(buf2, sizeof buf2, fmt,
|
snprintf(buf2, sizeof buf2, fmt,
|
||||||
(double)file->length);
|
(double)F_LENGTH(file));
|
||||||
n = buf2;
|
n = buf2;
|
||||||
break;
|
break;
|
||||||
case 'U':
|
case 'U':
|
||||||
@@ -512,7 +511,11 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
|
|||||||
n = op;
|
n = op;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
c = f_name(file, NULL);
|
if (fname) {
|
||||||
|
c = f_name_buf();
|
||||||
|
strlcpy(c, fname, MAXPATHLEN);
|
||||||
|
} else
|
||||||
|
c = f_name(file, NULL);
|
||||||
if (am_sender && file->dir.root) {
|
if (am_sender && file->dir.root) {
|
||||||
pathjoin(buf2, sizeof buf2,
|
pathjoin(buf2, sizeof buf2,
|
||||||
file->dir.root, c);
|
file->dir.root, c);
|
||||||
@@ -539,7 +542,11 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
|
|||||||
n++;
|
n++;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
c = f_name(file, NULL);
|
if (fname) {
|
||||||
|
c = f_name_buf();
|
||||||
|
strlcpy(c, fname, MAXPATHLEN);
|
||||||
|
} else
|
||||||
|
c = f_name(file, NULL);
|
||||||
if (S_ISDIR(file->mode))
|
if (S_ISDIR(file->mode))
|
||||||
strlcat(c, "/", MAXPATHLEN);
|
strlcat(c, "/", MAXPATHLEN);
|
||||||
n = c;
|
n = c;
|
||||||
@@ -548,7 +555,7 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
|
|||||||
if (hlink && *hlink) {
|
if (hlink && *hlink) {
|
||||||
n = hlink;
|
n = hlink;
|
||||||
strlcpy(buf2, " => ", sizeof buf2);
|
strlcpy(buf2, " => ", sizeof buf2);
|
||||||
} else if (S_ISLNK(file->mode)) {
|
} else if (S_ISLNK(file->mode) && !fname) {
|
||||||
n = F_SYMLINK(file);
|
n = F_SYMLINK(file);
|
||||||
strlcpy(buf2, " -> ", sizeof buf2);
|
strlcpy(buf2, " -> ", sizeof buf2);
|
||||||
} else {
|
} else {
|
||||||
@@ -708,11 +715,11 @@ void log_item(enum logcode code, struct file_struct *file,
|
|||||||
|
|
||||||
if (code != FLOG && stdout_format && !am_server) {
|
if (code != FLOG && stdout_format && !am_server) {
|
||||||
log_formatted(FCLIENT, stdout_format, s_or_r,
|
log_formatted(FCLIENT, stdout_format, s_or_r,
|
||||||
file, initial_stats, iflags, hlink);
|
file, NULL, initial_stats, iflags, hlink);
|
||||||
}
|
}
|
||||||
if (code != FCLIENT && logfile_format && *logfile_format) {
|
if (code != FCLIENT && logfile_format && *logfile_format) {
|
||||||
log_formatted(FLOG, logfile_format, s_or_r,
|
log_formatted(FLOG, logfile_format, s_or_r,
|
||||||
file, initial_stats, iflags, hlink);
|
file, NULL, initial_stats, iflags, hlink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,12 +743,15 @@ void maybe_log_item(struct file_struct *file, int iflags, int itemizing,
|
|||||||
|
|
||||||
void log_delete(const char *fname, int mode)
|
void log_delete(const char *fname, int mode)
|
||||||
{
|
{
|
||||||
static struct file_struct file;
|
static struct {
|
||||||
|
union flist_extras ex[4]; /* just in case... */
|
||||||
|
struct file_struct file;
|
||||||
|
char basename[1];
|
||||||
|
} x;
|
||||||
int len = strlen(fname);
|
int len = strlen(fname);
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
|
|
||||||
file.mode = mode;
|
x.file.mode = mode;
|
||||||
file.basename = fname;
|
|
||||||
|
|
||||||
if (!verbose && !stdout_format)
|
if (!verbose && !stdout_format)
|
||||||
;
|
;
|
||||||
@@ -751,7 +761,7 @@ void log_delete(const char *fname, int mode)
|
|||||||
send_msg(MSG_DELETED, fname, len);
|
send_msg(MSG_DELETED, fname, len);
|
||||||
} else {
|
} else {
|
||||||
fmt = stdout_format_has_o_or_i ? stdout_format : "deleting %n";
|
fmt = stdout_format_has_o_or_i ? stdout_format : "deleting %n";
|
||||||
log_formatted(FCLIENT, fmt, "del.", &file, &stats,
|
log_formatted(FCLIENT, fmt, "del.", &x.file, fname, &stats,
|
||||||
ITEM_DELETED, NULL);
|
ITEM_DELETED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,7 +769,7 @@ void log_delete(const char *fname, int mode)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fmt = logfile_format_has_o_or_i ? logfile_format : "deleting %n";
|
fmt = logfile_format_has_o_or_i ? logfile_format : "deleting %n";
|
||||||
log_formatted(FLOG, fmt, "del.", &file, &stats, ITEM_DELETED, NULL);
|
log_formatted(FLOG, fmt, "del.", &x.file, fname, &stats, ITEM_DELETED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
25
receiver.c
25
receiver.c
@@ -39,7 +39,6 @@ extern int preserve_hard_links;
|
|||||||
extern int preserve_perms;
|
extern int preserve_perms;
|
||||||
extern int basis_dir_cnt;
|
extern int basis_dir_cnt;
|
||||||
extern int make_backups;
|
extern int make_backups;
|
||||||
extern int flist_extra_ndx;
|
|
||||||
extern int cleanup_got_literal;
|
extern int cleanup_got_literal;
|
||||||
extern int remove_source_files;
|
extern int remove_source_files;
|
||||||
extern int append_mode;
|
extern int append_mode;
|
||||||
@@ -301,7 +300,7 @@ static void handle_delayed_updates(struct file_list *flist, char *local_name)
|
|||||||
full_fname(fname), partialptr);
|
full_fname(fname), partialptr);
|
||||||
} else {
|
} else {
|
||||||
if (remove_source_files
|
if (remove_source_files
|
||||||
|| (preserve_hard_links && IS_HLINKED(file)))
|
|| (preserve_hard_links && F_IS_HLINKED(file)))
|
||||||
send_msg_int(MSG_SUCCESS, i);
|
send_msg_int(MSG_SUCCESS, i);
|
||||||
handle_partial_dir(partialptr, PDIR_DELETE);
|
handle_partial_dir(partialptr, PDIR_DELETE);
|
||||||
}
|
}
|
||||||
@@ -414,7 +413,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
|
|
||||||
stats.current_file_index = i;
|
stats.current_file_index = i;
|
||||||
stats.num_transferred_files++;
|
stats.num_transferred_files++;
|
||||||
stats.total_transferred_size += file->length;
|
stats.total_transferred_size += F_LENGTH(file);
|
||||||
cleanup_got_literal = 0;
|
cleanup_got_literal = 0;
|
||||||
|
|
||||||
if (server_filter_list.head
|
if (server_filter_list.head
|
||||||
@@ -426,13 +425,13 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
if (!do_xfers) { /* log the transfer */
|
if (!do_xfers) { /* log the transfer */
|
||||||
log_item(FCLIENT, file, &stats, iflags, NULL);
|
log_item(FCLIENT, file, &stats, iflags, NULL);
|
||||||
if (read_batch)
|
if (read_batch)
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (write_batch < 0) {
|
if (write_batch < 0) {
|
||||||
log_item(FINFO, file, &stats, iflags, NULL);
|
log_item(FINFO, file, &stats, iflags, NULL);
|
||||||
if (!am_server)
|
if (!am_server)
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
rprintf(FINFO,
|
rprintf(FINFO,
|
||||||
"(Skipping batched update for \"%s\")\n",
|
"(Skipping batched update for \"%s\")\n",
|
||||||
fname);
|
fname);
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
next_gen_i = -1;
|
next_gen_i = -1;
|
||||||
@@ -524,7 +523,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
} else if (do_fstat(fd1,&st) != 0) {
|
} else if (do_fstat(fd1,&st) != 0) {
|
||||||
rsyserr(FERROR, errno, "fstat %s failed",
|
rsyserr(FERROR, errno, "fstat %s failed",
|
||||||
full_fname(fnamecmp));
|
full_fname(fnamecmp));
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
close(fd1);
|
close(fd1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -537,7 +536,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
*/
|
*/
|
||||||
rprintf(FERROR,"recv_files: %s is a directory\n",
|
rprintf(FERROR,"recv_files: %s is a directory\n",
|
||||||
full_fname(fnamecmp));
|
full_fname(fnamecmp));
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
close(fd1);
|
close(fd1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -560,14 +559,14 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
if (fd2 == -1) {
|
if (fd2 == -1) {
|
||||||
rsyserr(FERROR, errno, "open %s failed",
|
rsyserr(FERROR, errno, "open %s failed",
|
||||||
full_fname(fname));
|
full_fname(fname));
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
if (fd1 != -1)
|
if (fd1 != -1)
|
||||||
close(fd1);
|
close(fd1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!get_tmpname(fnametmp,fname)) {
|
if (!get_tmpname(fnametmp,fname)) {
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
if (fd1 != -1)
|
if (fd1 != -1)
|
||||||
close(fd1);
|
close(fd1);
|
||||||
continue;
|
continue;
|
||||||
@@ -593,7 +592,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
if (fd2 == -1) {
|
if (fd2 == -1) {
|
||||||
rsyserr(FERROR, errno, "mkstemp %s failed",
|
rsyserr(FERROR, errno, "mkstemp %s failed",
|
||||||
full_fname(fnametmp));
|
full_fname(fnametmp));
|
||||||
discard_receive_data(f_in, file->length);
|
discard_receive_data(f_in, F_LENGTH(file));
|
||||||
if (fd1 != -1)
|
if (fd1 != -1)
|
||||||
close(fd1);
|
close(fd1);
|
||||||
continue;
|
continue;
|
||||||
@@ -610,7 +609,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
|
|
||||||
/* recv file data */
|
/* recv file data */
|
||||||
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
|
recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
|
||||||
fname, fd2, file->length);
|
fname, fd2, F_LENGTH(file));
|
||||||
|
|
||||||
log_item(log_code, file, &initial_stats, iflags, NULL);
|
log_item(log_code, file, &initial_stats, iflags, NULL);
|
||||||
|
|
||||||
@@ -653,7 +652,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
|
|||||||
|
|
||||||
if (recv_ok > 0) {
|
if (recv_ok > 0) {
|
||||||
if (remove_source_files
|
if (remove_source_files
|
||||||
|| (preserve_hard_links && IS_HLINKED(file)))
|
|| (preserve_hard_links && F_IS_HLINKED(file)))
|
||||||
send_msg_int(MSG_SUCCESS, i);
|
send_msg_int(MSG_SUCCESS, i);
|
||||||
} else if (!recv_ok) {
|
} else if (!recv_ok) {
|
||||||
enum logcode msgtype = phase || read_batch ? FERROR : FINFO;
|
enum logcode msgtype = phase || read_batch ? FERROR : FINFO;
|
||||||
|
|||||||
2
sender.c
2
sender.c
@@ -230,7 +230,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
|
|||||||
|
|
||||||
stats.current_file_index = i;
|
stats.current_file_index = i;
|
||||||
stats.num_transferred_files++;
|
stats.num_transferred_files++;
|
||||||
stats.total_transferred_size += file->length;
|
stats.total_transferred_size += F_LENGTH(file);
|
||||||
|
|
||||||
if (!do_xfers) { /* log the transfer */
|
if (!do_xfers) { /* log the transfer */
|
||||||
log_item(FCLIENT, file, &stats, iflags, NULL);
|
log_item(FCLIENT, file, &stats, iflags, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user