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.
This commit is contained in:
David Dykstra
2003-01-26 03:53:34 +00:00
parent 536b84680b
commit aa2c47d835
2 changed files with 3 additions and 3 deletions

2
NEWS
View File

@@ -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)

View File

@@ -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);