pid_t cleanup_child_pid = -1;
/**
- * Eventually calls exit(), therefore does not return.
+ * Eventually calls exit(), passing @p code, therefore does not return.
*
* @param code one of the RERR_* codes from errcode.h.
**/
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);