make proto
---- batch.c 6 Mar 2004 07:45:52 -0000 1.31
-+++ batch.c 13 May 2004 18:54:03 -0000
-@@ -342,6 +342,8 @@ void show_flist(int index, struct file_s
+--- batch.c 15 May 2004 19:31:10 -0000 1.32
++++ batch.c 15 May 2004 20:13:11 -0000
+@@ -335,6 +335,8 @@ void show_flist(int index, struct file_s
rprintf(FINFO, "flist->flags=%#x\n", fptr[i]->flags);
rprintf(FINFO, "flist->modtime=%#lx\n",
(long unsigned) fptr[i]->modtime);
rprintf(FINFO, "flist->length=%.0f\n",
(double) fptr[i]->length);
rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
---- flist.c 11 May 2004 17:25:16 -0000 1.221
-+++ flist.c 13 May 2004 18:54:03 -0000
+--- flist.c 15 May 2004 19:31:10 -0000 1.223
++++ flist.c 15 May 2004 20:13:11 -0000
@@ -57,6 +57,7 @@ extern int relative_paths;
extern int implied_dirs;
extern int copy_links;
file->length = st.st_size;
file->mode = st.st_mode;
file->uid = st.st_uid;
---- generator.c 13 May 2004 06:55:01 -0000 1.82
-+++ generator.c 13 May 2004 18:54:03 -0000
+--- generator.c 15 May 2004 19:31:10 -0000 1.83
++++ generator.c 15 May 2004 20:13:11 -0000
@@ -98,7 +98,7 @@ static int skip_file(char *fname, struct
return 0;
}
}
-@@ -466,7 +466,7 @@ void recv_generator(char *fname, struct
+@@ -467,7 +467,7 @@ void recv_generator(char *fname, struct
return;
}
rprintf(FINFO,"%s is newer\n",fname);
return;
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 18:54:04 -0000
++++ options.c 15 May 2004 20:13:11 -0000
@@ -46,6 +46,7 @@ int preserve_devices = 0;
int preserve_uid = 0;
int preserve_gid = 0;
if (preserve_perms)
argstr[x++] = 'p';
if (recurse)
---- rsync.c 13 May 2004 18:51:22 -0000 1.138
-+++ rsync.c 13 May 2004 18:54:04 -0000
+--- rsync.c 15 May 2004 19:31:10 -0000 1.139
++++ rsync.c 15 May 2004 20:13:12 -0000
@@ -25,6 +25,7 @@
extern int verbose;
extern int dry_run;
- if (set_modtime(fname,file->modtime) != 0 &&
+ if (updated && set_times(fname, mtime, atime) != 0 &&
!S_ISDIR(st->st_mode)) {
- rprintf(FERROR, "failed to set times on %s: %s\n",
- full_fname(fname), strerror(errno));
+ rsyserr(FERROR, errno, "failed to set times on %s",
+ full_fname(fname));
return 0;
}
- updated = 1;
change_uid = am_root && preserve_uid && st->st_uid != file->uid;
--- rsync.h 13 May 2004 18:51:22 -0000 1.203
-+++ rsync.h 13 May 2004 18:54:04 -0000
++++ rsync.h 15 May 2004 20:13:12 -0000
@@ -54,6 +54,7 @@
#define XMIT_HAS_IDEV_DATA (1<<9)
#define XMIT_SAME_DEV (1<<10)
gid_t gid;
mode_t mode;
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 13 May 2004 18:54:05 -0000
++++ rsync.yo 15 May 2004 20:13:12 -0000
@@ -299,6 +299,7 @@ verb(
-g, --group preserve group
-D, --devices preserve devices (root only)
dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers,
instead it will just report the actions it would have taken.
---- tls.c 9 Apr 2004 20:22:44 -0000 1.19
-+++ tls.c 13 May 2004 18:54:05 -0000
+--- tls.c 15 May 2004 19:09:42 -0000 1.20
++++ tls.c 15 May 2004 20:13:13 -0000
@@ -39,6 +39,7 @@
+static int display_atime = 0;
- static void failed (char const *what,
- char const *where)
-@@ -57,14 +59,29 @@ static void failed (char const *what,
- exit (1);
+ static void failed(char const *what, char const *where)
+ {
+@@ -56,14 +58,29 @@ static void failed(char const *what, cha
+ exit(1);
}
+static void storetime(char *dest, time_t t)
+ }
+}
- static void list_file (const char *fname)
+ static void list_file(const char *fname)
{
STRUCT_STAT buf;
char permbuf[PERMSTRING_SIZE];
char linkbuf[4096];
if (do_lstat(fname, &buf) == -1)
-@@ -97,19 +114,8 @@ static void list_file (const char *fname
+@@ -96,19 +113,8 @@ static void list_file(const char *fname)
permstring(permbuf, buf.st_mode);
/* TODO: Perhaps escape special characters in fname? */
-@@ -120,24 +126,55 @@ static void list_file (const char *fname
+@@ -119,24 +125,55 @@ static void list_file(const char *fname)
(long)minor(buf.st_rdev));
} else /* NB: use double for size since it might not fit in a long. */
printf("%12.0f", (double)buf.st_size);
main(int argc, char *argv[])
{
- if (argc < 2) {
-- fprintf (stderr, "usage: " PROGRAM " DIR ...\n"
-- "Trivial file listing program for portably checking rsync\n");
+- fprintf(stderr, "usage: " PROGRAM " DIR ...\n"
+- "Trivial file listing program for portably checking rsync\n");
- return 1;
+ poptContext pc;
+ const char **extra_args;
}
- for (argv++; *argv; argv++) {
-- list_file (*argv);
+- list_file(*argv);
- }
+ extra_args = poptGetArgs(pc);
+ if (*extra_args == NULL)
return 0;
}
---- util.c 8 May 2004 20:03:39 -0000 1.142
-+++ util.c 13 May 2004 18:54:05 -0000
+--- util.c 15 May 2004 19:31:10 -0000 1.143
++++ util.c 15 May 2004 20:13:13 -0000
@@ -124,32 +124,40 @@ void overflow(char *str)
t[0].tv_usec = 0;
t[1].tv_sec = modtime;
t[1].tv_usec = 0;
-@@ -1063,8 +1071,8 @@ int msleep(int t)
+@@ -1058,8 +1066,8 @@ int msleep(int t)
/**
* --modify-window).
*
* @retval 0 if the times should be treated as the same
-@@ -1073,7 +1081,7 @@ int msleep(int t)
+@@ -1068,7 +1076,7 @@ int msleep(int t)
*
* @retval -1 if the 2nd is later
**/
extern int modify_window;
--- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ testsuite/copy-atimes.test 13 May 2004 18:54:05 -0000
++++ testsuite/copy-atimes.test 15 May 2004 20:13:13 -0000
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# The script would have aborted on error, so getting here means we've won.
+exit 0
--- testsuite/rsync.fns 4 Feb 2004 07:32:48 -0000 1.59
-+++ testsuite/rsync.fns 13 May 2004 18:54:05 -0000
++++ testsuite/rsync.fns 15 May 2004 20:13:13 -0000
@@ -51,7 +51,7 @@ printmsg() {
- if (set_modtime(fname,file->modtime) != 0 &&
- !S_ISDIR(st->st_mode)) {
+ if (set_modtime(fname,file->modtime) != 0) {
- rprintf(FERROR, "failed to set times on %s: %s\n",
- full_fname(fname), strerror(errno));
+ rsyserr(FERROR, errno, "failed to set times on %s",
+ full_fname(fname));
return 0;
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
+++ rsync.yo 13 May 2004 18:59:47 -0000
---- rsync.c 13 May 2004 18:51:22 -0000 1.138
-+++ rsync.c 13 May 2004 19:01:10 -0000
+--- rsync.c 15 May 2004 19:31:10 -0000 1.139
++++ rsync.c 15 May 2004 20:17:41 -0000
@@ -236,6 +236,9 @@ void finish_transfer(char *fname, char *
if (make_backups && !make_backup(fname))
return;
if (ret < 0) {
@@ -243,7 +246,8 @@ void finish_transfer(char *fname, char *
ret == -2 ? "copy" : "rename",
- full_fname(fnametmp), fname, strerror(errno));
+ full_fname(fnametmp), fname);
do_unlink(fnametmp);
- } else {
+ } else if (ret == 1) {
set_perms(fname, file, NULL,
ok_to_set_time ? 0 : PERMS_SKIP_MTIME);
}
---- t_stub.c 22 Apr 2004 09:58:11 -0000 1.7
-+++ t_stub.c 13 May 2004 19:01:10 -0000
+--- t_stub.c 15 May 2004 19:31:05 -0000 1.8
++++ t_stub.c 15 May 2004 20:17:41 -0000
@@ -26,6 +26,7 @@
* functions, so that module test harnesses can run standalone.
**/
int modify_window = 0;
int module_id = -1;
struct exclude_list_struct server_exclude_list;
---- util.c 8 May 2004 20:03:39 -0000 1.142
-+++ util.c 13 May 2004 19:01:10 -0000
+--- util.c 15 May 2004 19:31:10 -0000 1.143
++++ util.c 15 May 2004 20:17:41 -0000
@@ -28,6 +28,7 @@
#include "rsync.h"
extern struct exclude_list_struct server_exclude_list;
int sanitize_paths = 0;
-@@ -263,6 +264,8 @@ int copy_file(char *source, char *dest,
+@@ -261,6 +262,8 @@ int copy_file(char *source, char *dest,
return -1;
}
+ mode |= S_IWUSR;
ofd = do_open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, mode);
if (ofd == -1) {
- rprintf(FERROR,"open %s: %s\n",
-@@ -364,8 +367,8 @@ int robust_unlink(char *fname)
+ rsyserr(FERROR, errno, "open %s", full_fname(dest));
+@@ -359,8 +362,8 @@ int robust_unlink(char *fname)
#endif
}
int robust_rename(char *from, char *to, int mode)
{
int tries = 4;
-@@ -382,10 +385,12 @@ int robust_rename(char *from, char *to,
+@@ -377,10 +380,12 @@ int robust_rename(char *from, char *to,
break;
#endif
case EXDEV:
to be called on every file we write.
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 19:01:45 -0000
++++ options.c 15 May 2004 20:20:27 -0000
@@ -37,6 +37,7 @@ int make_backups = 0;
**/
int whole_file = -1;
if (compare_dest && am_sender) {
/* the server only needs this option if it is not the sender,
---- receiver.c 13 May 2004 07:08:22 -0000 1.77
-+++ receiver.c 13 May 2004 19:01:46 -0000
+--- receiver.c 15 May 2004 19:31:10 -0000 1.78
++++ receiver.c 15 May 2004 20:20:27 -0000
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
static void delete_one(char *fn, int is_dir)
{
-@@ -265,6 +266,12 @@ static int receive_data(int f_in,struct
+@@ -266,6 +267,12 @@ static int receive_data(int f_in,struct
if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
- rprintf(FERROR, "write failed on %s: %s\n",
-+ full_fname(fname), strerror(errno));
+ rsyserr(FERROR, errno, "write failed on %s",
++ full_fname(fname));
+ exit_cleanup(RERR_FILEIO);
+ }
+
+ if (do_fsync && (fd != -1) && (fsync(fd) != 0)) {
-+ rprintf(FERROR, "fsync failed on %s: %s\n",
- full_fname(fname), strerror(errno));
++ rsyserr(FERROR, errno, "fsync failed on %s",
+ full_fname(fname));
exit_cleanup(RERR_FILEIO);
}
---- util.c 8 May 2004 20:03:39 -0000 1.142
-+++ util.c 13 May 2004 19:01:46 -0000
+--- util.c 15 May 2004 19:31:10 -0000 1.143
++++ util.c 15 May 2004 20:20:28 -0000
@@ -29,6 +29,7 @@
extern int verbose;
int sanitize_paths = 0;
-@@ -296,6 +297,12 @@ int copy_file(char *source, char *dest,
+@@ -291,6 +292,12 @@ int copy_file(char *source, char *dest,
if (close(ofd) < 0) {
- rprintf(FERROR, "close failed on %s: %s\n",
-+ full_fname(dest), strerror(errno));
+ rsyserr(FERROR, errno, "close failed on %s",
++ full_fname(dest));
+ return -1;
+ }
+
+ if (do_fsync && fsync(ofd) < 0) {
-+ rprintf(FERROR, "fsync failed on %s: %s\n",
- full_fname(dest), strerror(errno));
++ rsyserr(FERROR, errno, "fsync failed on %s",
+ full_fname(dest));
return -1;
}
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
---- Makefile.in 2 May 2004 17:04:14 -0000 1.100
-+++ Makefile.in 13 May 2004 19:15:31 -0000
+--- Makefile.in 15 May 2004 00:48:11 -0000 1.101
++++ Makefile.in 15 May 2004 20:47:12 -0000
@@ -32,7 +32,7 @@ ZLIBOBJ=zlib/deflate.o zlib/infblock.o z
zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
zlib/zutil.o zlib/adler32.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
fileio.o batch.o clientname.o
OBJS3=progress.o pipe.o
---- generator.c 13 May 2004 06:55:01 -0000 1.82
-+++ generator.c 13 May 2004 19:15:31 -0000
+--- generator.c 15 May 2004 19:31:10 -0000 1.83
++++ generator.c 15 May 2004 20:47:12 -0000
@@ -51,6 +51,7 @@ extern int list_only;
extern int only_existing;
extern int orig_umask;
/* choose whether to skip a particular file */
-@@ -256,7 +257,62 @@ static void generate_and_send_sums(struc
+@@ -256,7 +257,61 @@ static void generate_and_send_sums(struc
}
}
+ STRUCT_STAT *st)
+{
+ int fd = -1;
-
++
+ if (statret == 0) {
+ if (S_ISREG(st->st_mode)) {
+ if (update_only
+ }
+ fd = do_open(fname, O_RDONLY, 0);
+ if (fd == -1) {
-+ rprintf(FERROR, "failed to open %s, continuing : %s\n",
-+ full_fname(fname), strerror(errno));
++ rsyserr(FERROR, errno, "failed to open %s, continuing",
++ full_fname(fname));
+ return -1;
+ }
+ return fd;
+
+ if (fd == -1 && compare_dest != NULL)
+ fd = open_alternate_base_comparedir(fname);
-+
+
+ if (fd == -1 && fuzzy)
+ fd = open_alternate_base_fuzzy(fname);
+
+ /* Update stat to understand size */
+ if (fd != -1) {
+ if (do_fstat(fd, st) != 0) {
-+ rprintf(FERROR, "fstat %s : %s\n",
-+ full_fname(fname), strerror(errno));
++ rsyserr(FERROR, errno, "fstat %s", full_fname(fname));
+ }
+ }
+
/**
* Acts on file number @p i from @p flist, whose name is @p fname.
-@@ -272,8 +328,6 @@ void recv_generator(char *fname, struct
+@@ -272,8 +327,6 @@ void recv_generator(char *fname, struct
STRUCT_STAT st;
struct map_struct *mapbuf;
int statret;
if (list_only)
return;
-@@ -398,108 +452,38 @@ void recv_generator(char *fname, struct
+@@ -400,107 +453,39 @@ void recv_generator(char *fname, struct
}
#endif
- else if (link_dest && !dry_run) {
- if (do_link(fnamecmpbuf, fname) != 0) {
- if (verbose > 0) {
-- rprintf(FINFO,"link %s => %s : %s\n",
-- fnamecmpbuf, fname,
-- strerror(errno));
+- rsyserr(FINFO, errno, "link %s => %s",
+- fnamecmpbuf, fname);
- }
- }
- fnamecmp = fnamecmpbuf;
- } else if (verbose > 1) {
+ /* Failed to stat for some reason besides "not found". */
+ if (statret == -1 && errno != ENOENT) {
-+ if (verbose > 1)
- rprintf(FERROR,
-- "recv_generator: failed to open %s: %s\n",
-+ "recv_generator failed to stat %s: %s\n",
- full_fname(fname), strerror(errno));
-- }
++ if (verbose > 1) {
+ rsyserr(FERROR, errno,
+- "recv_generator: failed to open %s",
++ "recv_generator failed to stat %s",
+ full_fname(fname));
+ }
return;
}
- return;
- write_int(f_out,i);
- if (!dry_run) write_sum_head(f_out, NULL);
-+ if ((fd = open_base_file(file, fname, statret, &st)) == -2)
- return;
+- return;
- }
-
- if (opt_ignore_existing && fnamecmp == fname) {
- if (verbose > 1)
- rprintf(FINFO,"%s exists\n",fname);
-- return;
++ if ((fd = open_base_file(file, fname, statret, &st)) == -2)
+ return;
- }
- if (update_only && cmp_modtime(st.st_mtime,file->modtime)>0 && fnamecmp == fname) {
- fd = do_open(fnamecmp, O_RDONLY, 0);
-
if (fd == -1) {
-- rprintf(FERROR, "failed to open %s, continuing: %s\n",
-- full_fname(fnamecmp), strerror(errno));
+- rsyserr(FERROR, errno, "failed to open %s, continuing",
+- full_fname(fnamecmp));
- /* pretend the file didn't exist */
+ /* the file didn't exist, or we can pretend it doesn't */
if (preserve_hard_links && hard_link_check(file, HL_SKIP))
return;
}
-@@ -509,7 +493,7 @@ void recv_generator(char *fname, struct
+@@ -510,7 +495,7 @@ void recv_generator(char *fname, struct
mapbuf = NULL;
if (verbose > 3) {
}
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 19:15:32 -0000
++++ options.c 15 May 2004 20:47:13 -0000
@@ -91,6 +91,7 @@ int ignore_errors = 0;
int modify_window = 0;
int blocking_io = -1;
*argc = ac;
return;
---- receiver.c 13 May 2004 07:08:22 -0000 1.77
-+++ receiver.c 13 May 2004 19:15:32 -0000
+--- receiver.c 15 May 2004 19:31:10 -0000 1.78
++++ receiver.c 15 May 2004 20:47:13 -0000
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
static void delete_one(char *fn, int is_dir)
{
-@@ -293,8 +294,6 @@ int recv_files(int f_in,struct file_list
+@@ -294,8 +295,6 @@ int recv_files(int f_in,struct file_list
char *fname, fbuf[MAXPATHLEN];
char template[MAXPATHLEN];
char fnametmp[MAXPATHLEN];
struct map_struct *mapbuf;
int i;
struct file_struct *file;
-@@ -357,35 +356,31 @@ int recv_files(int f_in,struct file_list
+@@ -358,35 +357,31 @@ int recv_files(int f_in,struct file_list
if (verbose > 2)
rprintf(FINFO,"recv_files(%s)\n",fname);
+ fd1 = open_alternate_base_fuzzy(fname);
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
- rprintf(FERROR, "fstat %s failed: %s\n",
-- full_fname(fnamecmp), strerror(errno));
-+ full_fname(fname), strerror(errno));
+ rsyserr(FERROR, errno, "fstat %s failed",
+- full_fname(fnamecmp));
++ full_fname(fname));
receive_data(f_in,NULL,-1,NULL,file->length);
close(fd1);
continue;
receive_data(f_in, NULL, -1, NULL, file->length);
close(fd1);
continue;
-@@ -406,8 +401,10 @@ int recv_files(int f_in,struct file_list
+@@ -407,8 +402,10 @@ int recv_files(int f_in,struct file_list
if (fd1 != -1 && st.st_size > 0) {
mapbuf = map_file(fd1,st.st_size);
Patch from Mark Curtis to implement the --inplace option.
--- match.c 13 May 2004 06:46:20 -0000 1.61
-+++ match.c 13 May 2004 19:02:25 -0000
++++ match.c 15 May 2004 20:23:18 -0000
@@ -22,6 +22,7 @@
extern int verbose;
extern int am_server;
if (verbose > 3)
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 19:02:25 -0000
++++ options.c 15 May 2004 20:23:19 -0000
@@ -91,6 +91,7 @@ int ignore_errors = 0;
int modify_window = 0;
int blocking_io = -1;
if (tmpdir) {
args[ac++] = "--temp-dir";
---- receiver.c 13 May 2004 07:08:22 -0000 1.77
-+++ receiver.c 13 May 2004 19:02:25 -0000
+--- receiver.c 15 May 2004 19:31:10 -0000 1.78
++++ receiver.c 15 May 2004 20:23:19 -0000
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
static void delete_one(char *fn, int is_dir)
{
-@@ -250,16 +251,28 @@ static int receive_data(int f_in,struct
+@@ -251,16 +252,28 @@ static int receive_data(int f_in,struct
sum_update(map,len);
}
- if (fd != -1 && write_file(fd,map,len) != (int) len) {
-- rprintf(FERROR, "write failed on %s: %s\n",
-- full_fname(fname), strerror(errno));
+- rsyserr(FERROR, errno, "write failed on %s",
+- full_fname(fname));
- exit_cleanup(RERR_FILEIO);
+ if (!inplace || offset != offset2) {
+ if (fd != -1 && write_file(fd,map,len) != (int) len) {
-+ rprintf(FERROR, "write failed on %s: %s\n",
-+ full_fname(fname), strerror(errno));
++ rsyserr(FERROR, errno, "write failed on %s",
++ full_fname(fname));
+ exit_cleanup(RERR_FILEIO);
+ }
+ } else {
if (do_progress)
end_progress(total_size);
-@@ -411,37 +424,50 @@ int recv_files(int f_in,struct file_list
+@@ -412,37 +425,50 @@ int recv_files(int f_in,struct file_list
} else
mapbuf = NULL;
+ if (inplace) {
+ fd2 = do_open(fnamecmp, O_WRONLY|O_CREAT, 0);
+ if (fd2 == -1) {
-+ rprintf(FERROR, "open %s failed: %s\n",
-+ full_fname(fnametmp), strerror(errno));
++ rsyserr(FERROR, errno, "open %s failed",
++ full_fname(fnametmp));
+ receive_data(f_in,mapbuf,-1,NULL,file->length);
+ if (mapbuf) unmap_file(mapbuf);
+ if (fd1 != -1) close(fd1);
fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
- }
- if (fd2 == -1) {
-- rprintf(FERROR, "mkstemp %s failed: %s\n",
-- full_fname(fnametmp), strerror(errno));
+- rsyserr(FERROR, errno, "mkstemp %s failed",
+- full_fname(fnametmp));
- receive_data(f_in,mapbuf,-1,NULL,file->length);
- if (mapbuf) unmap_file(mapbuf);
- if (fd1 != -1) close(fd1);
+ fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
+ }
+ if (fd2 == -1) {
-+ rprintf(FERROR, "mkstemp %s failed: %s\n",
-+ full_fname(fnametmp), strerror(errno));
++ rsyserr(FERROR, errno, "mkstemp %s failed",
++ full_fname(fnametmp));
+ receive_data(f_in,mapbuf,-1,NULL,file->length);
+ if (mapbuf) unmap_file(mapbuf);
+ if (fd1 != -1) close(fd1);
}
cleanup_set(fnametmp, fname, file, mapbuf, fd1, fd2);
---- rsync.c 13 May 2004 18:51:22 -0000 1.138
-+++ rsync.c 13 May 2004 19:02:25 -0000
+--- rsync.c 15 May 2004 19:31:10 -0000 1.139
++++ rsync.c 15 May 2004 20:23:19 -0000
@@ -31,6 +31,7 @@ extern int am_generator;
extern int preserve_uid;
extern int preserve_gid;
/* move tmp file over real file */
ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 13 May 2004 19:02:26 -0000
++++ rsync.yo 15 May 2004 20:23:20 -0000
@@ -289,6 +289,7 @@ verb(
--backup-dir make backups into this directory
--suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
the file's name.
---- Makefile.in 2 May 2004 17:04:14 -0000 1.100
-+++ Makefile.in 13 May 2004 19:04:49 -0000
+--- Makefile.in 15 May 2004 00:48:11 -0000 1.101
++++ Makefile.in 15 May 2004 20:29:17 -0000
@@ -35,7 +35,7 @@ OBJS1=rsync.o generator.o receiver.o cle
main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
--- /dev/null 1 Jan 1970 00:00:00 -0000
-+++ hashlink.c 13 May 2004 19:04:49 -0000
-@@ -0,0 +1,351 @@
++++ hashlink.c 15 May 2004 20:29:17 -0000
+@@ -0,0 +1,342 @@
+/*
+ Copyright (C) Cronosys, LLC 2004
+
+ /* Build a list of potential candidates and open
+ * them. */
+ if ((d = opendir(hashname)) == NULL) {
-+ rprintf(FERROR,"opendir \"%s\": %s\n",
-+ hashname, strerror(errno));
++ rsyserr(FERROR, errno, "opendir \"%s\"", hashname);
+ free(hashname);
+ return NULL;
+ }
+ asprintf(&hashfile->name,"%s/%s",hashname,
+ di->d_name);
+ if (do_stat(hashfile->name,&st) == -1) {
-+ rprintf(FERROR,"%s: %s", hashfile->name,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "%s: %s", hashfile->name);
+ kill_hashfile(hashfile);
+ continue;
+ }
+ hashfile->nlink = st.st_nlink;
+ hashfile->fd = open(hashfile->name,O_RDONLY|O_BINARY);
+ if (hashfile->fd == -1) {
-+ rprintf(FERROR,"%s: %s\n", hashfile->name,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "%s", hashfile->name);
+ kill_hashfile(hashfile);
+ continue;
+ }
+ }
+
+ if (amt == -1) {
-+ rprintf(FERROR,"%s",strerror(errno));
++ rsyserr(FERROR, errno, "%s");
+ kill_hashfiles(files);
+ return NULL;
+ }
+ dirname = strdup(hashname);
+ *strrchr(dirname,'/') = 0;
+ if (do_mkdir(dirname, 0755) == -1 && errno != EEXIST) {
-+ rprintf(FERROR, "mkdir %s: %s\n", dirname,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "mkdir %s", dirname);
+ free(hashname);
+ free(dirname);
+ return robust_rename(fnametmp,fname,0644);
+ free(dirname);
+
+ if (do_mkdir(hashname, 0755) == -1 && errno != EEXIST) {
-+ rprintf(FERROR, "mkdir %s: %s\n", hashname,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "mkdir %s", hashname);
+ free(hashname);
+ return robust_rename(fnametmp,fname,0644);
+ }
+ int fd;
+
+ if (do_stat(fnametmp,&st) == -1) {
-+ rprintf(FERROR,"%s: %s\n",fname,strerror(errno));
++ rsyserr(FERROR, errno, "%s", fname);
+ return -1;
+ }
+ hashfiles = find_hashfiles(hashname, st.st_size, &last_fnbr);
+
+ /* Search for one identical to us. */
+ if ((fd = open(fnametmp,O_RDONLY|O_BINARY)) == -1) {
-+ rprintf(FERROR,"%s: %s\n",fnametmp,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "%s", fnametmp);
+ kill_hashfiles(hashfiles);
+ return -1;
+ }
+ rprintf(FINFO, "(5) linkname = %s\n", linkname);
+ rprintf(FINFO,"link-by-hash: max link count exceeded, starting new file \"%s\".\n", linkname);
+ } else {
-+ rprintf(FERROR,"link \"%s\" -> %s: %s\n",
-+ linkname,full_fname(fname),
-+ strerror(errno));
++ rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
++ linkname, full_fname(fname));
+ robust_unlink(fname);
+ rc = robust_rename(fnametmp,fname,0644);
+ }
+
+ rc = robust_rename(fnametmp,fname,0644);
+ if (rc != 0) {
-+ rprintf(FERROR,"rename \"%s\" -> \"%s\": %s\n",
-+ full_fname(fnametmp),full_fname(fname),
-+ strerror(errno));
++ rsyserr(FERROR, errno, "rename \"%s\" -> \"%s\"",
++ full_fname(fnametmp), full_fname(fname));
+ }
+ rc = do_link(fname,linkname);
+ if (rc != 0) {
-+ rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n",
-+ full_fname(fname),linkname,
-+ strerror(errno));
++ rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
++ full_fname(fname), linkname);
+ }
+ }
+
+
+#endif
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 19:04:49 -0000
++++ options.c 15 May 2004 20:29:17 -0000
@@ -121,6 +121,7 @@ char *log_format = NULL;
char *password_file = NULL;
char *rsync_path = RSYNC_PATH;
}
if (files_from && (!am_sender || remote_filesfrom_file)) {
---- receiver.c 13 May 2004 07:08:22 -0000 1.77
-+++ receiver.c 13 May 2004 19:04:49 -0000
+--- receiver.c 15 May 2004 19:31:10 -0000 1.78
++++ receiver.c 15 May 2004 20:29:17 -0000
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
static void delete_one(char *fn, int is_dir)
{
-@@ -191,10 +192,11 @@ static int get_tmpname(char *fnametmp, c
+@@ -192,10 +193,11 @@ static int get_tmpname(char *fnametmp, c
static int receive_data(int f_in,struct map_struct *mapbuf,int fd,char *fname,
unsigned int len;
OFF_T offset = 0;
OFF_T offset2;
-@@ -204,7 +206,9 @@ static int receive_data(int f_in,struct
+@@ -205,7 +207,9 @@ static int receive_data(int f_in,struct
char *map=NULL;
read_sum_head(f_in, &sum);
sum_init();
while ((i = recv_token(f_in, &data)) != 0) {
-@@ -221,6 +225,8 @@ static int receive_data(int f_in,struct
+@@ -222,6 +226,8 @@ static int receive_data(int f_in,struct
cleanup_got_literal = 1;
sum_update(data,i);
+ mdfour_update(&mdfour_data,data,i);
if (fd != -1 && write_file(fd,data,i) != i) {
- rprintf(FERROR, "write failed on %s: %s\n",
-@@ -248,6 +254,8 @@ static int receive_data(int f_in,struct
+ rsyserr(FERROR, errno, "write failed on %s",
+@@ -249,6 +255,8 @@ static int receive_data(int f_in,struct
see_token(map, len);
sum_update(map,len);
}
if (fd != -1 && write_file(fd,map,len) != (int) len) {
-@@ -270,6 +278,8 @@ static int receive_data(int f_in,struct
+@@ -271,6 +279,8 @@ static int receive_data(int f_in,struct
}
sum_end(file_sum1);
read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2) {
-@@ -373,7 +383,7 @@ int recv_files(int f_in,struct file_list
+@@ -374,7 +384,7 @@ int recv_files(int f_in,struct file_list
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
- rprintf(FERROR, "fstat %s failed: %s\n",
- full_fname(fnamecmp), strerror(errno));
+ rsyserr(FERROR, errno, "fstat %s failed",
+ full_fname(fnamecmp));
- receive_data(f_in,NULL,-1,NULL,file->length);
+ receive_data(f_in,NULL,-1,NULL,file->length,NULL);
close(fd1);
continue;
}
-@@ -386,7 +396,7 @@ int recv_files(int f_in,struct file_list
+@@ -387,7 +397,7 @@ int recv_files(int f_in,struct file_list
*/
rprintf(FERROR,"recv_files: %s is a directory\n",
full_fname(fnamecmp));
close(fd1);
continue;
}
-@@ -438,7 +448,7 @@ int recv_files(int f_in,struct file_list
+@@ -439,7 +449,7 @@ int recv_files(int f_in,struct file_list
if (fd2 == -1) {
- rprintf(FERROR, "mkstemp %s failed: %s\n",
- full_fname(fnametmp), strerror(errno));
+ rsyserr(FERROR, errno, "mkstemp %s failed",
+ full_fname(fnametmp));
- receive_data(f_in,mapbuf,-1,NULL,file->length);
+ receive_data(f_in,mapbuf,-1,NULL,file->length,NULL);
if (mapbuf) unmap_file(mapbuf);
if (fd1 != -1) close(fd1);
continue;
-@@ -451,7 +461,12 @@ int recv_files(int f_in,struct file_list
+@@ -452,7 +462,12 @@ int recv_files(int f_in,struct file_list
}
/* recv file data */
log_recv(file, &initial_stats);
---- rsync.c 13 May 2004 18:51:22 -0000 1.138
-+++ rsync.c 13 May 2004 19:04:49 -0000
+--- rsync.c 15 May 2004 19:31:10 -0000 1.139
++++ rsync.c 15 May 2004 20:29:17 -0000
@@ -31,6 +31,7 @@ extern int am_generator;
extern int preserve_uid;
extern int preserve_gid;
+#endif
+ ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS);
if (ret < 0) {
- rprintf(FERROR, "%s %s -> \"%s\": %s\n",
+ rsyserr(FERROR, errno, "%s %s -> \"%s\"",
ret == -2 ? "copy" : "rename",
--- rsync.h 13 May 2004 18:51:22 -0000 1.203
-+++ rsync.h 13 May 2004 19:04:50 -0000
++++ rsync.h 15 May 2004 20:29:18 -0000
@@ -521,6 +521,14 @@ struct stats {
int current_file_index;
};
make proto
---- io.c 8 May 2004 18:03:43 -0000 1.120
-+++ io.c 13 May 2004 18:57:54 -0000
+--- io.c 15 May 2004 19:31:10 -0000 1.121
++++ io.c 15 May 2004 20:15:14 -0000
@@ -222,6 +222,14 @@ static void read_msg_fd(void)
read_loop(fd, buf, 4);
redo_list_add(IVAL(buf,0));
case MSG_INFO:
case MSG_ERROR:
case MSG_LOG:
-@@ -637,6 +645,16 @@ static int read_unbuffered(int fd, char
+@@ -635,6 +643,16 @@ static int read_unbuffered(int fd, char
}
read_loop(fd, buffer, remaining);
bufferIdx = 0;
break;
case MSG_INFO:
case MSG_ERROR:
---- main.c 10 Feb 2004 03:54:47 -0000 1.192
-+++ main.c 13 May 2004 18:57:54 -0000
+--- main.c 15 May 2004 19:31:10 -0000 1.194
++++ main.c 15 May 2004 20:15:15 -0000
@@ -42,6 +42,7 @@ extern int list_only;
extern int local_server;
extern int log_got_error;
extern int orig_umask;
extern int preserve_hard_links;
extern int protocol_version;
-@@ -567,6 +568,8 @@ void start_server(int f_in, int f_out, i
+@@ -566,6 +567,8 @@ void start_server(int f_in, int f_out, i
io_start_multiplex_out(f_out);
if (am_sender) {
if (!read_batch) {
recv_exclude_list(f_in);
if (cvs_exclude)
-@@ -632,6 +635,9 @@ int client_run(int f_in, int f_out, pid_
+@@ -631,6 +634,9 @@ int client_run(int f_in, int f_out, pid_
io_flush(FULL_FLUSH);
exit_cleanup(status);
}
+ if (need_messages_from_generator)
+ io_start_multiplex_out(f_out);
- if (argc == 0) {
+ if (argc == 0)
list_only = 1;
--- options.c 6 May 2004 21:08:01 -0000 1.148
-+++ options.c 13 May 2004 18:57:55 -0000
++++ options.c 15 May 2004 20:15:15 -0000
@@ -84,6 +84,7 @@ int copy_unsafe_links = 0;
int size_only = 0;
int bwlimit = 0;
*argc = ac;
return;
---- receiver.c 13 May 2004 07:08:22 -0000 1.77
-+++ receiver.c 13 May 2004 18:57:55 -0000
+--- receiver.c 15 May 2004 19:31:10 -0000 1.78
++++ receiver.c 15 May 2004 20:15:15 -0000
@@ -46,6 +46,7 @@ extern int module_id;
extern int ignore_errors;
extern int orig_umask;
static void delete_one(char *fn, int is_dir)
{
-@@ -293,7 +294,7 @@ int recv_files(int f_in,struct file_list
+@@ -294,7 +295,7 @@ int recv_files(int f_in,struct file_list
char *fname, fbuf[MAXPATHLEN];
char template[MAXPATHLEN];
char fnametmp[MAXPATHLEN];
char fnamecmpbuf[MAXPATHLEN];
struct map_struct *mapbuf;
int i;
-@@ -475,16 +476,20 @@ int recv_files(int f_in,struct file_list
+@@ -476,16 +477,20 @@ int recv_files(int f_in,struct file_list
cleanup_disable();
}
}
--- rsync.h 13 May 2004 18:51:22 -0000 1.203
-+++ rsync.h 13 May 2004 18:57:55 -0000
++++ rsync.h 15 May 2004 20:15:15 -0000
@@ -60,6 +60,7 @@
#define FLAG_TOP_DIR (1<<0)
#define FLAG_HLINK_EOL (1<<1) /* generator only */
MSG_REDO=4, /* reprocess indicated flist index */
MSG_ERROR=FERROR, MSG_INFO=FINFO, MSG_LOG=FLOG, /* remote logging */
--- rsync.yo 7 May 2004 00:18:37 -0000 1.169
-+++ rsync.yo 13 May 2004 18:57:56 -0000
++++ rsync.yo 15 May 2004 20:15:16 -0000
@@ -312,6 +312,7 @@ verb(
--delete delete files that don't exist on sender
--delete-excluded also delete excluded files on receiver
dit(bf(--ignore-errors)) Tells --delete to go ahead and delete files
even when there are I/O errors.
---- sender.c 11 May 2004 19:53:16 -0000 1.39
-+++ sender.c 13 May 2004 18:57:56 -0000
+--- sender.c 15 May 2004 19:31:10 -0000 1.40
++++ sender.c 15 May 2004 20:15:16 -0000
@@ -27,6 +27,7 @@ extern int dry_run;
extern int am_server;
extern int am_daemon;
while (1) {
unsigned int offset;
-@@ -299,6 +324,9 @@ void send_files(struct file_list *flist,
+@@ -300,6 +325,9 @@ void send_files(struct file_list *flist,
if (verbose > 2)
rprintf(FINFO, "sender finished %s\n", fname);
--- loadparm.c 4 Feb 2004 07:31:29 -0000 1.50
-+++ loadparm.c 22 Apr 2004 23:49:29 -0000
++++ loadparm.c 15 May 2004 20:50:11 -0000
@@ -119,6 +119,7 @@ typedef struct
char *comment;
char *lock_file;
FN_LOCAL_BOOL(lp_list, list)
FN_LOCAL_BOOL(lp_use_chroot, use_chroot)
FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
---- main.c 10 Feb 2004 03:54:47 -0000 1.192
-+++ main.c 22 Apr 2004 23:49:29 -0000
-@@ -370,6 +370,12 @@ static void do_server_sender(int f_in, i
+--- main.c 15 May 2004 19:31:10 -0000 1.194
++++ main.c 15 May 2004 20:50:11 -0000
+@@ -369,6 +369,12 @@ static void do_server_sender(int f_in, i
(long)getpid());
}
+ }
+
if (!relative_paths && !push_dir(dir)) {
- rprintf(FERROR, "push_dir %s failed: %s (3)\n",
- full_fname(dir), strerror(errno));
+ rsyserr(FERROR, errno, "push_dir#3 %s failed",
+ full_fname(dir));