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
Added some more "const" prefixes to some "char *" vars.
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
55a6499
..
325c101
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-48,6
+48,8
@@
extern int preserve_uid;
extern int preserve_gid;
extern int relative_paths;
extern int implied_dirs;
extern int preserve_gid;
extern int relative_paths;
extern int implied_dirs;
+extern int ignore_perishable;
+extern int non_perishable_cnt;
extern int prune_empty_dirs;
extern int copy_links;
extern int copy_unsafe_links;
extern int prune_empty_dirs;
extern int copy_links;
extern int copy_unsafe_links;
@@
-253,7
+255,7
@@
static mode_t from_wire_mode(int mode)
static void send_directory(int f, struct file_list *flist,
char *fbuf, int len);
static void send_directory(int f, struct file_list *flist,
char *fbuf, int len);
-static char *flist_dir;
+static c
onst c
har *flist_dir;
static int flist_dir_len;
static int flist_dir_len;
@@
-394,8
+396,7
@@
static void send_file_entry(struct file_struct *file, int f)
flags |= XMIT_TOP_DIR;
if ((flags & 0xFF00) || !flags) {
flags |= XMIT_EXTENDED_FLAGS;
flags |= XMIT_TOP_DIR;
if ((flags & 0xFF00) || !flags) {
flags |= XMIT_EXTENDED_FLAGS;
- write_byte(f, flags);
- write_byte(f, flags >> 8);
+ write_shortint(f, flags);
} else
write_byte(f, flags);
} else {
} else
write_byte(f, flags);
} else {
@@
-453,8
+454,8
@@
static void send_file_entry(struct file_struct *file, int f)
if (file->link_u.idev) {
if (protocol_version < 26) {
/* 32-bit dev_t and ino_t */
if (file->link_u.idev) {
if (protocol_version < 26) {
/* 32-bit dev_t and ino_t */
- write_int(f, dev);
- write_int(f, file->F_INODE);
+ write_int(f,
(int32)
dev);
+ write_int(f,
(int32)
file->F_INODE);
} else {
/* 64-bit dev_t and ino_t */
if (!(flags & XMIT_SAME_DEV))
} else {
/* 64-bit dev_t and ino_t */
if (!(flags & XMIT_SAME_DEV))
@@
-465,7
+466,7
@@
static void send_file_entry(struct file_struct *file, int f)
#endif
if (always_checksum && (S_ISREG(mode) || protocol_version < 28)) {
#endif
if (always_checksum && (S_ISREG(mode) || protocol_version < 28)) {
- char *sum;
+ c
onst c
har *sum;
if (S_ISREG(mode))
sum = file->u.sum;
else {
if (S_ISREG(mode))
sum = file->u.sum;
else {
@@
-717,7
+718,7
@@
static struct file_struct *receive_file_entry(struct file_list *flist,
* statting directories if we're not recursing, but this is not a very
* important case. Some systems may not have d_type.
**/
* statting directories if we're not recursing, but this is not a very
* important case. Some systems may not have d_type.
**/
-struct file_struct *make_file(char *fname, struct file_list *flist,
+struct file_struct *make_file(c
onst c
har *fname, struct file_list *flist,
STRUCT_STAT *stp, unsigned short flags,
int filter_level)
{
STRUCT_STAT *stp, unsigned short flags,
int filter_level)
{
@@
-752,8
+753,12
@@
struct file_struct *make_file(char *fname, struct file_list *flist,
int save_errno = errno;
/* See if file is excluded before reporting an error. */
if (filter_level != NO_FILTERS
int save_errno = errno;
/* See if file is excluded before reporting an error. */
if (filter_level != NO_FILTERS
- && is_excluded(thisname, 0, filter_level))
+ && (is_excluded(thisname, 0, filter_level)
+ || is_excluded(thisname, 1, filter_level))) {
+ if (ignore_perishable && save_errno != ENOENT)
+ non_perishable_cnt++;
return NULL;
return NULL;
+ }
if (save_errno == ENOENT) {
#ifdef SUPPORT_LINKS
/* Avoid "vanished" error if symlink points nowhere. */
if (save_errno == ENOENT) {
#ifdef SUPPORT_LINKS
/* Avoid "vanished" error if symlink points nowhere. */
@@
-788,7
+793,7
@@
struct file_struct *make_file(char *fname, struct file_list *flist,
return NULL;
}
return NULL;
}
- /*
We only care about
directories because we need to avoid recursing
+ /*
-x only affects
directories because we need to avoid recursing
* into a mount-point directory, not to avoid copying a symlinked
* file if -L (or similar) was specified. */
if (one_file_system && st.st_dev != filesystem_dev
* into a mount-point directory, not to avoid copying a symlinked
* file if -L (or similar) was specified. */
if (one_file_system && st.st_dev != filesystem_dev
@@
-803,8
+808,11
@@
struct file_struct *make_file(char *fname, struct file_list *flist,
flags |= FLAG_MOUNT_POINT;
}
flags |= FLAG_MOUNT_POINT;
}
- if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level))
+ if (is_excluded(thisname, S_ISDIR(st.st_mode) != 0, filter_level)) {
+ if (ignore_perishable)
+ non_perishable_cnt++;
return NULL;
return NULL;
+ }
if (lp_ignore_nonreadable(module_id)) {
#ifdef SUPPORT_LINKS
if (lp_ignore_nonreadable(module_id)) {
#ifdef SUPPORT_LINKS
@@
-1207,7
+1215,7
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
}
if (dir && *dir) {
}
if (dir && *dir) {
- static char *lastdir;
+ static c
onst c
har *lastdir;
static int lastdir_len;
strlcpy(olddir, curr_dir, sizeof olddir);
static int lastdir_len;
strlcpy(olddir, curr_dir, sizeof olddir);
@@
-1228,11
+1236,8
@@
struct file_list *send_file_list(int f, int argc, char *argv[])
}
}
}
}
- if (fn != fbuf) {
- if (len >= MAXPATHLEN)
- overflow_exit("send_file_list");
+ if (fn != fbuf)
memmove(fbuf, fn, len + 1);
memmove(fbuf, fn, len + 1);
- }
if (implied_dirs && (p=strrchr(fbuf,'/')) && p != fbuf) {
/* Send the implied directories at the start of the
if (implied_dirs && (p=strrchr(fbuf,'/')) && p != fbuf) {
/* Send the implied directories at the start of the
@@
-1444,10
+1449,10
@@
int flist_find(struct file_list *flist, struct file_struct *f)
if (mid_up > high) {
/* If there's nothing left above us, set high to
* a non-empty entry below us and continue. */
if (mid_up > high) {
/* If there's nothing left above us, set high to
* a non-empty entry below us and continue. */
- high = mid - flist->files[mid]->length;
+ high = mid -
(int)
flist->files[mid]->length;
if (!flist->files[high]->basename) {
do {
if (!flist->files[high]->basename) {
do {
- high -= flist->files[high]->length;
+ high -=
(int)
flist->files[high]->length;
} while (!flist->files[high]->basename);
flist->files[mid]->length = mid - high;
}
} while (!flist->files[high]->basename);
flist->files[mid]->length = mid - high;
}
@@
-1499,8
+1504,7
@@
struct file_list *flist_new(int with_hlink, char *msg)
memset(flist, 0, sizeof (struct file_list));
memset(flist, 0, sizeof (struct file_list));
- if (!(flist->file_pool = pool_create(FILE_EXTENT, 0,
- out_of_memory, POOL_INTERN)))
+ if (!(flist->file_pool = pool_create(FILE_EXTENT, 0, out_of_memory, POOL_INTERN)))
out_of_memory(msg);
#ifdef SUPPORT_HARD_LINKS
out_of_memory(msg);
#ifdef SUPPORT_HARD_LINKS