From: David Dykstra Date: Sun, 26 Jan 2003 03:53:34 +0000 (+0000) Subject: Better fix for infinite recursion; don't return from exit_cleanup X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/aa2c47d83558ebb5def69d6c2fa2d6fe70b49db0 Better fix for infinite recursion; don't return from exit_cleanup unless the nesting is already pretty deep, because there are normal cases where exit_cleanup is nested shallowly. Patch from Marc Espie, posted by Brian Poole. --- diff --git a/NEWS b/NEWS index 2e6404d8..5149b77f 100644 --- a/NEWS +++ b/NEWS @@ -69,7 +69,7 @@ rsync changes since last release broken. (Dave Dykstra) * Prevent infinite recursion in cleanup code under certain circumstances. - (Sviatoslav Sviridov) + (Sviatoslav Sviridov and Marc Espie) * Fixed a bug that prevented rsync from creating intervening directories when --relative-paths/-R is set. (Craig Barratt) diff --git a/cleanup.c b/cleanup.c index b9e9dabe..8543217d 100644 --- a/cleanup.c +++ b/cleanup.c @@ -63,11 +63,11 @@ void _exit_cleanup(int code, const char *file, int line) extern int log_got_error; static int inside_cleanup = 0; - if (inside_cleanup != 0) { + if (inside_cleanup > 10) { /* prevent the occasional infinite recursion */ return; } - inside_cleanup = 1; + inside_cleanup++; signal(SIGUSR1, SIG_IGN); signal(SIGUSR2, SIG_IGN);