[eggheads-patches] PATCH: illegalsock.patch

Fabian Knittel fknittel at gmx.de
Wed Oct 6 15:39:26 CST 1999


[ illegalsock.patch ]

main() was using the wrong variable to kill illegal sockets. It
used xx, which is checked to be -1 when coming into that section,
and tried to killsock that if no corresponding dcc entry could
be found. Now it uses i, which holds the actual socket.

The upside is, that we avoid something simialer to a loop if a
socket, which got lost some how, eof's. The downside is, that
noone will bother to report cases where we lose track of such
a socket, because they'll not notice so easily.

There still seem to be cases where we do lose track in the source.
Otherwise I wouldn't have noticed ... :/

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Wed Oct  6 18:24:37 1999
+++ eggdrop1.3/doc/UPDATES1.3	Wed Oct  6 22:08:53 1999
@@ -4,6 +4,7 @@
 
 1.3.29
 Foundby   Fixedby   What....
+	  Fabian    main() wasn't removing unknown sockets correctly
 	  Fabian    probably fixes the "un-allocated socket" problem
  	  Fabian/   Changed RFC_COMPLIANT flag to dynamic variable setting
 	  drummer
diff -urN eggdrop1.3~/src/main.c eggdrop1.3/src/main.c
--- eggdrop1.3~/src/main.c	Tue Oct  5 11:26:44 1999
+++ eggdrop1.3/src/main.c	Wed Oct  6 22:10:48 1999
@@ -793,18 +793,17 @@
 	  else {
 	    putlog(LOG_MISC, "*",
 		   "*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED",
-		   xx, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*");
-	    killsock(xx);
+		   i, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*");
+	    killsock(i);
 	    lostdcc(idx);
 	  }
 	  idx = dcc_total + 1;
 	}
       if (idx == dcc_total) {
 	putlog(LOG_MISC, "*",
-	       "(@) EOF socket %d, not a dcc socket, not anything.",
-	       xx);
-	close(xx);
-	killsock(xx);
+	       "(@) EOF socket %d, not a dcc socket, not anything.", i);
+	close(i);
+	killsock(i);
       }
     } else if ((xx == -2) && (errno != EINTR)) {	/* select() error */
       context;


More information about the Patches mailing list