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 code to implement the delete-during handling.
[rsync/rsync.git]
/
main.c
diff --git
a/main.c
b/main.c
index
7ff33f5
..
086de30
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-33,8
+33,9
@@
extern int verbose;
extern int blocking_io;
extern int cvs_exclude;
extern int delete_mode;
extern int blocking_io;
extern int cvs_exclude;
extern int delete_mode;
-extern int delete_
excluded
;
+extern int delete_
before
;
extern int delete_after;
extern int delete_after;
+extern int delete_excluded;
extern int daemon_over_rsh;
extern int do_stats;
extern int dry_run;
extern int daemon_over_rsh;
extern int do_stats;
extern int dry_run;
@@
-59,6
+60,7
@@
extern int filesfrom_fd;
extern pid_t cleanup_child_pid;
extern char *files_from;
extern char *remote_filesfrom_file;
extern pid_t cleanup_child_pid;
extern char *files_from;
extern char *remote_filesfrom_file;
+extern char *partial_dir;
extern char *basis_dir[];
extern char *rsync_path;
extern char *shell_cmd;
extern char *basis_dir[];
extern char *rsync_path;
extern char *shell_cmd;
@@
-432,7
+434,7
@@
static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
argv[i] += l+1;
}
argv[i] += l+1;
}
- if (argc == 0 &&
recurse
) {
+ if (argc == 0 &&
(recurse || list_only)
) {
argc = 1;
argv--;
argv[0] = ".";
argc = 1;
argv--;
argv[0] = ".";
@@
-463,7
+465,7
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
int pid;
int status = 0;
int error_pipe[2], name_pipe[2];
int pid;
int status = 0;
int error_pipe[2], name_pipe[2];
- BOOL need_name_pipe =
basis_dir[0]
&& !dry_run;
+ BOOL need_name_pipe =
(basis_dir[0] || partial_dir)
&& !dry_run;
/* The receiving side mustn't obey this, or an existing symlink that
* points to an identical file won't be replaced by the referent. */
/* The receiving side mustn't obey this, or an existing symlink that
* points to an identical file won't be replaced by the referent. */
@@
-472,9
+474,9
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
if (preserve_hard_links)
init_hard_links(flist);
if (preserve_hard_links)
init_hard_links(flist);
- if (
!delete_after
) {
+ if (
delete_before
) {
/* I moved this here from recv_files() to prevent a race condition */
/* I moved this here from recv_files() to prevent a race condition */
- if (recurse &&
delete_mode &&
!local_name && flist->count > 0)
+ if (recurse && !local_name && flist->count > 0)
delete_files(flist);
}
delete_files(flist);
}
@@
-540,7
+542,6
@@
static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
generate_files(f_out, flist, local_name, name_pipe[1]);
generate_files(f_out, flist, local_name, name_pipe[1]);
- get_redo_num(); /* Read final MSG_DONE and any prior messages. */
report(-1);
io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
report(-1);
io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
@@
-671,9
+672,7
@@
int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
char *local_name = NULL;
cleanup_child_pid = pid;
char *local_name = NULL;
cleanup_child_pid = pid;
- if (read_batch) {
- assert(am_sender == 0);
- } else {
+ if (!read_batch) {
set_nonblocking(f_in);
set_nonblocking(f_out);
}
set_nonblocking(f_in);
set_nonblocking(f_out);
}
@@
-733,7
+732,7
@@
int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
}
if (argc == 0)
}
if (argc == 0)
- list_only = 1;
+ list_only
|
= 1;
if (!read_batch)
send_exclude_list(f_out);
if (!read_batch)
send_exclude_list(f_out);
@@
-964,9
+963,8
@@
static int start_client(int argc, char *argv[])
}
/* ... or no dest at all */
}
/* ... or no dest at all */
- if (!am_sender && argc == 0) {
- list_only = 1;
- }
+ if (!am_sender && argc == 0)
+ list_only |= 1;
pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,
&f_in,&f_out);
pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path,
&f_in,&f_out);