mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-05-24 23:05:52 -04:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99994aef3e | ||
|
|
78043d1969 | ||
|
|
43e46b4cf6 | ||
|
|
9ec16c83be | ||
|
|
a24c687094 | ||
|
|
60cb2f9016 | ||
|
|
ac1a0994b6 | ||
|
|
f2cbf44ba5 | ||
|
|
dab552237e | ||
|
|
2201ba580e | ||
|
|
b7c33e3bde | ||
|
|
82980a2384 | ||
|
|
b6a30afc98 | ||
|
|
ed91f3e418 | ||
|
|
60c8d7bc7f |
@@ -20,8 +20,6 @@ SHELL=/bin/sh
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
HEADS=byteorder.h config.h errcode.h proto.h rsync.h version.h \
|
||||
lib/fnmatch.h lib/getopt.h lib/mdfour.h
|
||||
LIBOBJ=lib/getopt.o lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o
|
||||
ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
|
||||
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
|
||||
@@ -55,8 +53,6 @@ install-strip:
|
||||
rsync: $(OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o rsync $(OBJS) $(LIBS)
|
||||
|
||||
$(OBJS): $(HEADS)
|
||||
|
||||
rsync.1: rsync.yo
|
||||
yodl2man -o rsync.1 rsync.yo
|
||||
|
||||
|
||||
1
access.c
1
access.c
@@ -68,6 +68,7 @@ static int match_address(char *addr, char *tok)
|
||||
mask = ntohl(mask);
|
||||
} else {
|
||||
int bits = atoi(p+1);
|
||||
if (bits == 0) return 1;
|
||||
if (bits <= 0 || bits > 32) {
|
||||
rprintf(FERROR,"malformed mask in %s\n", tok);
|
||||
return 0;
|
||||
|
||||
5
backup.c
5
backup.c
@@ -197,7 +197,10 @@ static int keep_backup(char *fname)
|
||||
if (do_stat (fname, &st)) return 1;
|
||||
#endif
|
||||
|
||||
file = make_file (0, fname, 0);
|
||||
file = make_file(-1, fname, NULL, 1);
|
||||
|
||||
/* the file could have disappeared */
|
||||
if (!file) return 1;
|
||||
|
||||
/* make a complete pathname for backup file */
|
||||
if (strlen(backup_dir) + strlen(fname) > (MAXPATHLEN - 1)) {
|
||||
|
||||
3
config.guess
vendored
3
config.guess
vendored
@@ -977,6 +977,9 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-qnx-qnx${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
*:"Mac OS":*:*)
|
||||
echo `uname -p`-apple-macos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
||||
17
flist.c
17
flist.c
@@ -469,7 +469,8 @@ static int skip_filesystem(char *fname, STRUCT_STAT *st)
|
||||
#define MALLOC(ap, i) (ap ? string_area_malloc(ap, i) : malloc(i))
|
||||
|
||||
/* create a file_struct for a named file */
|
||||
struct file_struct *make_file(int f, char *fname, struct string_area **ap)
|
||||
struct file_struct *make_file(int f, char *fname, struct string_area **ap,
|
||||
int noexcludes)
|
||||
{
|
||||
struct file_struct *file;
|
||||
STRUCT_STAT st;
|
||||
@@ -478,6 +479,7 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap)
|
||||
char cleaned_name[MAXPATHLEN];
|
||||
char linkbuf[MAXPATHLEN];
|
||||
extern int delete_excluded;
|
||||
extern int module_id;
|
||||
|
||||
strlcpy(cleaned_name, fname, MAXPATHLEN);
|
||||
cleaned_name[MAXPATHLEN-1] = 0;
|
||||
@@ -496,6 +498,9 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* we use noexcludes from backup.c */
|
||||
if (noexcludes) goto skip_excludes;
|
||||
|
||||
if (S_ISDIR(st.st_mode) && !recurse) {
|
||||
rprintf(FINFO,"skipping directory %s\n",fname);
|
||||
return NULL;
|
||||
@@ -509,7 +514,13 @@ struct file_struct *make_file(int f, char *fname, struct string_area **ap)
|
||||
/* f is set to -1 when calculating deletion file list */
|
||||
if (((f != -1) || !delete_excluded) && !match_file_name(fname,&st))
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
if (lp_ignore_nonreadable(module_id) && access(fname, R_OK) != 0)
|
||||
return NULL;
|
||||
|
||||
skip_excludes:
|
||||
|
||||
if (verbose > 2)
|
||||
rprintf(FINFO,"make_file(%d,%s)\n",f,fname);
|
||||
|
||||
@@ -588,7 +599,7 @@ void send_file_name(int f,struct file_list *flist,char *fname,
|
||||
{
|
||||
struct file_struct *file;
|
||||
|
||||
file = make_file(f,fname, &flist->string_area);
|
||||
file = make_file(f,fname, &flist->string_area, 0);
|
||||
|
||||
if (!file) return;
|
||||
|
||||
|
||||
10
generator.c
10
generator.c
@@ -35,6 +35,7 @@ extern int size_only;
|
||||
extern int io_timeout;
|
||||
extern int remote_version;
|
||||
extern int always_checksum;
|
||||
extern char *compare_dest;
|
||||
|
||||
|
||||
/* choose whether to skip a particular file */
|
||||
@@ -49,6 +50,15 @@ static int skip_file(char *fname,
|
||||
of the file time to determine whether to sync */
|
||||
if (always_checksum && S_ISREG(st->st_mode)) {
|
||||
char sum[MD4_SUM_LENGTH];
|
||||
char fnamecmpdest[MAXPATHLEN];
|
||||
|
||||
if (compare_dest != NULL) {
|
||||
if (access(fname, 0) != 0) {
|
||||
slprintf(fnamecmpdest,MAXPATHLEN,"%s/%s",
|
||||
compare_dest,fname);
|
||||
fname = fnamecmpdest;
|
||||
}
|
||||
}
|
||||
file_checksum(fname,sum,st->st_size);
|
||||
if (remote_version < 21) {
|
||||
return (memcmp(sum,file->sum,2) == 0);
|
||||
|
||||
@@ -134,6 +134,7 @@ typedef struct
|
||||
char *dont_compress;
|
||||
int timeout;
|
||||
int max_connections;
|
||||
BOOL ignore_nonreadable;
|
||||
} service;
|
||||
|
||||
|
||||
@@ -164,7 +165,8 @@ static service sDefault =
|
||||
NULL, /* refuse options */
|
||||
"*.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz", /* dont compress */
|
||||
0, /* timeout */
|
||||
0 /* max connections */
|
||||
0, /* max connections */
|
||||
False /* ignore nonreadable */
|
||||
};
|
||||
|
||||
|
||||
@@ -262,6 +264,7 @@ static struct parm_struct parm_table[] =
|
||||
{"read only", P_BOOL, P_LOCAL, &sDefault.read_only, NULL, 0},
|
||||
{"list", P_BOOL, P_LOCAL, &sDefault.list, NULL, 0},
|
||||
{"use chroot", P_BOOL, P_LOCAL, &sDefault.use_chroot, NULL, 0},
|
||||
{"ignore nonreadable",P_BOOL, P_LOCAL, &sDefault.ignore_nonreadable, NULL, 0},
|
||||
{"uid", P_STRING, P_LOCAL, &sDefault.uid, NULL, 0},
|
||||
{"gid", P_STRING, P_LOCAL, &sDefault.gid, NULL, 0},
|
||||
{"hosts allow", P_STRING, P_LOCAL, &sDefault.hosts_allow, NULL, 0},
|
||||
@@ -340,6 +343,7 @@ FN_LOCAL_BOOL(lp_list, list)
|
||||
FN_LOCAL_BOOL(lp_use_chroot, use_chroot)
|
||||
FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
|
||||
FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
|
||||
FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
|
||||
FN_LOCAL_STRING(lp_uid, uid)
|
||||
FN_LOCAL_STRING(lp_gid, gid)
|
||||
FN_LOCAL_STRING(lp_hosts_allow, hosts_allow)
|
||||
|
||||
13
main.c
13
main.c
@@ -25,6 +25,19 @@ struct stats stats;
|
||||
|
||||
extern int verbose;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
wait for a process to exit, calling io_flush while waiting
|
||||
****************************************************************************/
|
||||
void wait_process(pid_t pid, int *status)
|
||||
{
|
||||
while (waitpid(pid, status, WNOHANG) == 0) {
|
||||
msleep(20);
|
||||
io_flush();
|
||||
}
|
||||
*status = WEXITSTATUS(*status);
|
||||
}
|
||||
|
||||
static void report(int f)
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Summary: Program for efficient remote updates of files.
|
||||
Name: rsync
|
||||
Version: 2.4.4
|
||||
Version: 2.4.5
|
||||
Release: 1
|
||||
Copyright: GPL
|
||||
Group: Applications/Networking
|
||||
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.4.4.tar.gz
|
||||
Source: ftp://samba.anu.edu.au/pub/rsync/rsync-2.4.5.tar.gz
|
||||
URL: http://samba.anu.edu.au/rsync/
|
||||
Packager: Andrew Tridgell <tridge@samba.anu.edu.au>
|
||||
BuildRoot: /tmp/rsync
|
||||
|
||||
4
rsync.h
4
rsync.h
@@ -510,4 +510,8 @@ size_t strlcpy(char *d, const char *s, size_t bufsize);
|
||||
size_t strlcat(char *d, const char *s, size_t bufsize);
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF))
|
||||
#endif
|
||||
|
||||
#define exit_cleanup(code) _exit_cleanup(code, __FILE__, __LINE__)
|
||||
|
||||
@@ -285,6 +285,11 @@ to a temporary resource shortage or other IO error. In some cases this
|
||||
test is counter productive so you can use this option to turn off this
|
||||
behaviour.
|
||||
|
||||
dit(bf(ignore nonreadable)) This tells the rsync server to completely
|
||||
ignore files that are not readable by the user. This is useful for
|
||||
public archives that may have some non-readable files among the
|
||||
directories, and the sysadmin doesn't want those files to be seen at all.
|
||||
|
||||
dit(bf(transfer logging)) The "transfer logging" option enables per-file
|
||||
logging of downloads and uploads in a format somewhat similar to that
|
||||
used by ftp daemons. If you want to customize the log formats look at
|
||||
|
||||
30
util.c
30
util.c
@@ -930,16 +930,28 @@ char *timestring(time_t t)
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
like waitpid but does the WEXITSTATUS
|
||||
****************************************************************************/
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF))
|
||||
#endif
|
||||
void wait_process(pid_t pid, int *status)
|
||||
/*******************************************************************
|
||||
sleep for a specified number of milliseconds
|
||||
********************************************************************/
|
||||
void msleep(int t)
|
||||
{
|
||||
waitpid(pid, status, 0);
|
||||
*status = WEXITSTATUS(*status);
|
||||
int tdiff=0;
|
||||
struct timeval tval,t1,t2;
|
||||
|
||||
gettimeofday(&t1, NULL);
|
||||
gettimeofday(&t2, NULL);
|
||||
|
||||
while (tdiff < t) {
|
||||
tval.tv_sec = (t-tdiff)/1000;
|
||||
tval.tv_usec = 1000*((t-tdiff)%1000);
|
||||
|
||||
errno = 0;
|
||||
select(0,NULL,NULL, NULL, &tval);
|
||||
|
||||
gettimeofday(&t2, NULL);
|
||||
tdiff = (t2.tv_sec - t1.tv_sec)*1000 +
|
||||
(t2.tv_usec - t1.tv_usec)/1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user