PATCH: don't leave core behind on distant machine

Marc Espie espie at
Sat Dec 14 18:34:01 EST 2002

I've noticed that
rsync -e ssh network:some

would tend to leave cores behind on the distand machine.

Turns out rsync was trying to log a final error message... which could
not get written to stderr... which got detected by rwrite... which called
exit_cleanup... which in turn tried to write to stderr....... until all
stack got eaten up.

This patch fixes the infinite recursion.

--- cleanup.c.orig	Sat Dec 14 18:55:23 2002
+++ cleanup.c	Sat Dec 14 18:55:55 2002
@@ -43,6 +43,12 @@ void _exit_cleanup(int code, const char 
 	int ocode = code;
 	extern int keep_partial;
 	extern int log_got_error;
+	static int in_cleanup = 0;
+	/* forbid recursive calls */
+	if (in_cleanup)
+		return;
+	in_cleanup = 1;
 	signal(SIGUSR1, SIG_IGN);
 	signal(SIGUSR2, SIG_IGN);

More information about the rsync mailing list