X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/e0fde757fda15c0596914e6dc29dcd92a5b6448f..deec574421aea793cc2093e676adc798989181fa:/cleanup.c diff --git a/cleanup.c b/cleanup.c index 904fbaab..8543217d 100644 --- a/cleanup.c +++ b/cleanup.c @@ -52,7 +52,7 @@ extern int io_error; pid_t cleanup_child_pid = -1; /** - * Eventually calls exit(), therefore does not return. + * Eventually calls exit(), passing @p code, therefore does not return. * * @param code one of the RERR_* codes from errcode.h. **/ @@ -61,6 +61,13 @@ void _exit_cleanup(int code, const char *file, int line) int ocode = code; extern int keep_partial; extern int log_got_error; + static int inside_cleanup = 0; + + if (inside_cleanup > 10) { + /* prevent the occasional infinite recursion */ + return; + } + inside_cleanup++; signal(SIGUSR1, SIG_IGN); signal(SIGUSR2, SIG_IGN);