disallow infinite call chains of exit_cleanup

(this happened when the pipe to rsync got broken, because rsync would
then try to write to stderr, find out it didn't work, and call exit_cleanup,
which would then try it all over again... oops.
This commit is contained in:
espie 2002-12-14 18:06:58 +00:00
parent bacb07a045
commit 255768ca8b

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-cleanup_c,v 1.1 2002/12/14 18:06:58 espie Exp $
--- 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);