/* 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.
*/
/* status of requested child no longer available.
* check to see if it was processed by the sigchld_handler.
*/
/* status of requested child no longer available.
* check to see if it was processed by the sigchld_handler.
*/
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)) {
- if (!push_dir(name, 0)) {
- rprintf(FERROR, "push_dir %s failed: %s (1)\n",
- full_fname(name), strerror(errno));
+ if (!push_dir(name)) {
+ rsyserr(FERROR, errno, "push_dir#1 %s failed",
+ full_fname(name));
- rprintf(FERROR, "mkdir %s failed: %s\n",
- full_fname(name), strerror(errno));
+ rsyserr(FERROR, errno, "mkdir %s failed", full_fname(name));
exit_cleanup(RERR_FILEIO);
} else {
if (verbose > 0)
rprintf(FINFO,"created directory %s\n",name);
}
exit_cleanup(RERR_FILEIO);
} else {
if (verbose > 0)
rprintf(FINFO,"created directory %s\n",name);
}
- if (!push_dir(name, 0)) {
- rprintf(FERROR, "push_dir %s failed: %s (2)\n",
- full_fname(name), strerror(errno));
+ if (!push_dir(name)) {
+ rsyserr(FERROR, errno, "push_dir#2 %s failed",
+ full_fname(name));
- if (verbose > 2)
- rprintf(FINFO,"server_sender starting pid=%d\n",(int)getpid());
+ if (verbose > 2) {
+ rprintf(FINFO, "server_sender starting pid=%ld\n",
+ (long)getpid());
+ }
+
+ if (am_daemon && lp_write_only(module_id) && am_sender) {
+ rprintf(FERROR, "ERROR: module is write only\n");
+ exit_cleanup(RERR_SYNTAX);
+ return;
+ }
- if (!relative_paths && !push_dir(dir, 0)) {
- rprintf(FERROR, "push_dir %s failed: %s (3)\n",
- full_fname(dir), strerror(errno));
+ if (!relative_paths && !push_dir(dir)) {
+ rsyserr(FERROR, errno, "push_dir#3 %s failed",
+ full_fname(dir));
- 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");
- if (!am_daemon && !push_dir(dir, 0)) {
- rprintf(FERROR, "push_dir %s failed: %s (4)\n",
- full_fname(dir), strerror(errno));
+ if (!am_daemon && !push_dir(dir)) {
+ rsyserr(FERROR, errno, "push_dir#4 %s failed",
+ full_fname(dir));
* (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);