static void show_malloc_stats(void);
/* Works like waitpid(), but if we already harvested the child pid in our
- * sigchld_handler(), we succeed instead of returning an error. */
+ * remember_children(), we succeed instead of returning an error. */
pid_t wait_process(pid_t pid, int *status_ptr, int flags)
{
pid_t waited_pid = waitpid(pid, status_ptr, flags);
if (waited_pid == -1 && errno == ECHILD) {
/* Status of requested child no longer available: check to
- * see if it was processed by sigchld_handler(). */
+ * see if it was processed by remember_children(). */
int cnt;
for (cnt = 0; cnt < MAXCHILDPROCS; cnt++) {
if (pid == pid_stat_table[cnt].pid) {
flist->count, NS(dest_path));
}
- if (!dest_path)
+ if (!dest_path || list_only)
return NULL;
/* If the destination path refers to an existing directory, enter
io_set_sock_fds(f_in, f_out);
setup_protocol(f_out, f_in);
-#ifdef HAVE_ICONV
+#if defined HAVE_ICONV_OPEN && defined HAVE_ICONV_H
setup_iconv();
#endif
io_set_sock_fds(f_in, f_out);
setup_protocol(f_out,f_in);
-#ifdef HAVE_ICONV
+#if defined HAVE_ICONV_OPEN && defined HAVE_ICONV_H
setup_iconv();
#endif
return rc;
if (!read_batch) { /* for read_batch, NO source is specified */
- argc--;
shell_path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
if (shell_path) { /* source is remote */
char *dummy1;
int dummy2;
- if (argc && check_for_hostspec(argv[argc], &dummy1, &dummy2)) {
+ if (--argc
+ && check_for_hostspec(argv[argc], &dummy1, &dummy2)) {
rprintf(FERROR,
"The source and destination cannot both be remote.\n");
exit_cleanup(RERR_SYNTAX);
} else { /* source is local, check dest arg */
am_sender = 1;
- if (argc < 1) { /* destination required */
- usage(FERROR);
- exit_cleanup(RERR_SYNTAX);
+ if (argc > 1)
+ p = argv[--argc];
+ else {
+ p = ".";
+ list_only = 1;
}
- shell_path = check_for_hostspec(argv[argc], &shell_machine, &rsync_port);
+ shell_path = check_for_hostspec(p, &shell_machine, &rsync_port);
if (shell_path && filesfrom_host && *filesfrom_host
&& strcmp(filesfrom_host, shell_machine) != 0) {
rprintf(FERROR,
exit_cleanup(RERR_SYNTAX);
}
shell_machine = NULL;
- shell_path = argv[argc];
+ shell_path = p;
} else if (rsync_port) {
if (!shell_cmd) {
return start_socket_client(shell_machine,
_exit(0);
}
-static RETSIGTYPE sigchld_handler(UNUSED(int val))
+RETSIGTYPE remember_children(UNUSED(int val))
{
#ifdef WNOHANG
int cnt, status;
}
#endif
#ifndef HAVE_SIGACTION
- signal(SIGCHLD, sigchld_handler);
+ signal(SIGCHLD, remember_children);
#endif
}
#endif
SIGACTMASK(SIGUSR1, sigusr1_handler);
SIGACTMASK(SIGUSR2, sigusr2_handler);
- SIGACTMASK(SIGCHLD, sigchld_handler);
+ SIGACTMASK(SIGCHLD, remember_children);
#ifdef MAINTAINER_MODE
SIGACTMASK(SIGSEGV, rsync_panic_handler);
SIGACTMASK(SIGFPE, rsync_panic_handler);
/* Ignore SIGPIPE; we consistently check error codes and will
* see the EPIPE. */
SIGACTION(SIGPIPE, SIG_IGN);
+#ifdef SIGXFSZ
+ SIGACTION(SIGXFSZ, SIG_IGN);
+#endif
/* Initialize push_dir here because on some old systems getcwd
* (implemented by forking "pwd" and reading its output) doesn't