From b765ec32b93d8fa78f19a48fbc7cc9066beb488e Mon Sep 17 00:00:00 2001 From: David Dykstra Date: Thu, 16 Jan 2003 20:09:31 +0000 Subject: [PATCH] Prevent infinite recursion in exit_cleanup(). Patch from Sviatoslav Sviridov. --- NEWS | 3 +++ cleanup.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/NEWS b/NEWS index f44216c7..0717163c 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,9 @@ rsync changes since last release * Fixed bug in --copy-unsafe-links that caused it to be completely broken. (Dave Dykstra) + * Prevent infinite recursion in cleanup code under certain circumstances. + (Sviatoslav Sviridov) + INTERNAL: * Many code cleanups and improved internal documentation. (Martin diff --git a/cleanup.c b/cleanup.c index 37e074a0..b9e9dabe 100644 --- a/cleanup.c +++ b/cleanup.c @@ -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 != 0) { + /* prevent the occasional infinite recursion */ + return; + } + inside_cleanup = 1; signal(SIGUSR1, SIG_IGN); signal(SIGUSR2, SIG_IGN); -- 2.34.1