summaryrefslogtreecommitdiff
path: root/source/n/rdist/rdist-6.1.5-14.fix-msgsndnotify-loop.diff
blob: d34aa78d81c4c1437c8c9cdcbd79763652329273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- rdist-6.1.5/src/message.c.thestokes	2006-04-19 17:30:39.000000000 -0400
+++ rdist-6.1.5/src/message.c	2006-04-19 17:36:37.000000000 -0400
@@ -793,15 +793,20 @@
 	char *msg;
 {
 	static char buf[MSGBUFSIZ];
-
-	++nerrs;
-
-	if (isserver)
-		(void) sprintf(buf, "REMOTE ERROR: %s", msg);
-	else
-		(void) sprintf(buf, "LOCAL ERROR: %s", msg);
-
-	_message(MT_FERROR, buf);
+	/* Don't reenter this function. There is a nasty infinite recursion
+	   case that pops up when msgsndnotify tries to exit. */
+	static int inside=0; 
+
+	if(inside==0){
+	        ++nerrs;
+		inside=1;
+
+	        if (isserver)
+		        (void) sprintf(buf, "REMOTE ERROR: %s", msg);
+	        else
+		        (void) sprintf(buf, "LOCAL ERROR: %s", msg);
+		_message(MT_FERROR, buf);
+	}
 
 	exit(nerrs);
 }