[prev in list] [next in list] [prev in thread] [next in thread] 

List:       maradns-list
Subject:    FIX: the filedescriptor leak patch
From:       Franky Van Liedekerke <liedekef () pandora ! be>
Date:       2002-05-18 16:19:58
[Download RAW message or body]

Hi,

in attachment the patch to fix the filedescriptor leak in MaraDNS,
apply first the maradns-0.9.30.logging.patch.txt Sam sent in a previous mail.
To patch this file, enter the maradns-0.9.30 directory and
run the following command:

	patch -p1 < fd.patch.txt

Where fd.patch.txt is the attachment.

Franky
["fd.patch.txt" (text/plain)]

--- maradns-0.9.30/server/recursive.c	Sat May 18 18:15:20 2002
+++ maradns-0.9.31/server/recursive.c	Sat May 18 17:33:26 2002
@@ -1321,17 +1321,6 @@
         return JS_ERROR;
         }
 
-    /* Create a UDP client socket */
-    if((s = socket(AF_INET,SOCK_DGRAM,0)) == -1) {
-        if(rlog_level >= 4) {
-            write_lock();
-            show_timestamp();
-            printf("Failure creating socket\n");
-            write_unlock();
-            }
-        goto cleanup;
-	}
-
     /* Create a server socket address to use with sendto() */
     memset(&server,0,sizeof(server));
     server.sin_family = AF_INET;
@@ -1413,8 +1402,20 @@
        system will generate a secure source UDP port number if the
        source port is not bound */
     /* BEGIN RNG USING CODE */
+    /* Create a UDP client socket */
+    if((s = socket(AF_INET,SOCK_DGRAM,0)) == -1) {
+        if(rlog_level >= 4) {
+            write_lock();
+            show_timestamp();
+            printf("Failure creating socket\n");
+            write_unlock();
+            }
+        goto cleanup;
+	}
+
     /* Bind to a secure psudo-random address and port */
     if(bind(s,(struct sockaddr *)&dns_udp,sizeof(dns_udp)) < 0) {
+	close(s);
         if(rlog_level >= 4) {
             write_lock();
             show_timestamp();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic