+extern int blocking_io;
+extern int cvs_exclude;
+extern int delete_mode;
+extern int delete_excluded;
+extern int delete_after;
+extern int daemon_over_rsh;
+extern int do_stats;
+extern int dry_run;
+extern int list_only;
+extern int local_server;
+extern int log_got_error;
+extern int module_id;
+extern int orig_umask;
+extern int preserve_hard_links;
+extern int recurse;
+extern int relative_paths;
+extern int rsync_port;
+extern int read_batch;
+extern int write_batch;
+extern int filesfrom_fd;
+extern pid_t cleanup_child_pid;
+extern char *files_from;
+extern char *remote_filesfrom_file;
+extern char *rsync_path;
+extern char *shell_cmd;
+extern struct file_list *batch_flist;
+
/* there's probably never more than at most 2 outstanding child processes,
* but set it higher just in case.
/* there's probably never more than at most 2 outstanding child processes,
* but set it higher just in case.
if (am_daemon) {
log_exit(0, __FILE__, __LINE__);
if (f == -1 || !am_sender) return;
}
if (am_daemon) {
log_exit(0, __FILE__, __LINE__);
if (f == -1 || !am_sender) return;
}
int64 r;
stats.total_written = read_longint(f);
/* store total_read in a temporary, read_longint changes it */
int64 r;
stats.total_written = read_longint(f);
/* store total_read in a temporary, read_longint changes it */
- if (!am_sender && !send_stats) {
- /* missing the bytes written by the generator */
- rprintf(FINFO, "\nCannot show stats as receiver because remote protocol version is less than 20\n");
- rprintf(FINFO, "Use --stats -v to show stats\n");
- return;
- }
rprintf(FINFO,"\nNumber of files: %d\n", stats.num_files);
rprintf(FINFO,"Number of files transferred: %d\n",
stats.num_transferred_files);
rprintf(FINFO,"\nNumber of files: %d\n", stats.num_files);
rprintf(FINFO,"Number of files transferred: %d\n",
stats.num_transferred_files);
getpid(),
am_server ? "server " : "",
am_daemon ? "daemon " : "",
getpid(),
am_server ? "server " : "",
am_daemon ? "daemon " : "",
rprintf(FINFO, " arena: %10d (bytes from sbrk)\n", mi.arena);
rprintf(FINFO, " ordblks: %10d (chunks not in use)\n", mi.ordblks);
rprintf(FINFO, " smblks: %10d\n", mi.smblks);
rprintf(FINFO, " hblks: %10d (chunks from mmap)\n", mi.hblks);
rprintf(FINFO, " hblkhd: %10d (bytes from mmap)\n", mi.hblkhd);
rprintf(FINFO, " arena: %10d (bytes from sbrk)\n", mi.arena);
rprintf(FINFO, " ordblks: %10d (chunks not in use)\n", mi.ordblks);
rprintf(FINFO, " smblks: %10d\n", mi.smblks);
rprintf(FINFO, " hblks: %10d (chunks from mmap)\n", mi.hblks);
rprintf(FINFO, " hblkhd: %10d (bytes from mmap)\n", mi.hblkhd);
rprintf(FINFO, " usmblks: %10d\n", mi.usmblks);
rprintf(FINFO, " fsmblks: %10d\n", mi.fsmblks);
rprintf(FINFO, " uordblks: %10d (bytes used)\n", mi.uordblks);
rprintf(FINFO, " usmblks: %10d\n", mi.usmblks);
rprintf(FINFO, " fsmblks: %10d\n", mi.fsmblks);
rprintf(FINFO, " uordblks: %10d (bytes used)\n", mi.uordblks);
-static pid_t do_cmd(char *cmd,char *machine,char *user,char *path,int *f_in,int *f_out)
+static pid_t do_cmd(char *cmd, char *machine, char *user, char *path,
+ int *f_in, int *f_out)
if (do_stat(name,&st) == 0) {
if (S_ISDIR(st.st_mode)) {
if (do_stat(name,&st) == 0) {
if (S_ISDIR(st.st_mode)) {
rprintf(FERROR, "push_dir %s failed: %s (1)\n",
full_fname(name), strerror(errno));
exit_cleanup(RERR_FILESELECT);
rprintf(FERROR, "push_dir %s failed: %s (1)\n",
full_fname(name), strerror(errno));
exit_cleanup(RERR_FILESELECT);
rprintf(FERROR, "push_dir %s failed: %s (2)\n",
full_fname(name), strerror(errno));
exit_cleanup(RERR_FILESELECT);
rprintf(FERROR, "push_dir %s failed: %s (2)\n",
full_fname(name), strerror(errno));
exit_cleanup(RERR_FILESELECT);
static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
{
int i;
struct file_list *flist;
char *dir = argv[0];
static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
{
int i;
struct file_list *flist;
char *dir = argv[0];
rprintf(FERROR, "push_dir %s failed: %s (3)\n",
full_fname(dir), strerror(errno));
exit_cleanup(RERR_FILESELECT);
rprintf(FERROR, "push_dir %s failed: %s (3)\n",
full_fname(dir), strerror(errno));
exit_cleanup(RERR_FILESELECT);
- if (verbose > 2)
- rprintf(FINFO,"server_recv(%d) starting pid=%d\n",argc,(int)getpid());
+ if (verbose > 2) {
+ rprintf(FINFO, "server_recv(%d) starting pid=%ld\n",
+ argc, (long)getpid());
+ }
if (am_daemon && lp_read_only(module_id) && !am_sender) {
rprintf(FERROR,"ERROR: module is read only\n");
if (am_daemon && lp_read_only(module_id) && !am_sender) {
rprintf(FERROR,"ERROR: module is read only\n");
rprintf(FERROR, "push_dir %s failed: %s (4)\n",
full_fname(dir), strerror(errno));
exit_cleanup(RERR_FILESELECT);
rprintf(FERROR, "push_dir %s failed: %s (4)\n",
full_fname(dir), strerror(errno));
exit_cleanup(RERR_FILESELECT);
void start_server(int f_in, int f_out, int argc, char *argv[])
{
void start_server(int f_in, int f_out, int argc, char *argv[])
{
struct file_list *flist = NULL;
int status = 0, status2 = 0;
char *local_name = NULL;
struct file_list *flist = NULL;
int status = 0, status2 = 0;
char *local_name = NULL;
send_files(flist,f_out,f_in);
io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
send_files(flist,f_out,f_in);
io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
* (implemented by forking "pwd" and reading its output) doesn't
* work when there are other child processes. Also, on all systems
* that implement getcwd that way "pwd" can't be found after chroot. */
* (implemented by forking "pwd" and reading its output) doesn't
* work when there are other child processes. Also, on all systems
* that implement getcwd that way "pwd" can't be found after chroot. */
if (write_batch && !am_server) {
write_batch_argvs_file(orig_argc, orig_argv);
if (write_batch && !am_server) {
write_batch_argvs_file(orig_argc, orig_argv);