bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fd leak in cfexecd


From: Michael Santos
Subject: Re: fd leak in cfexecd
Date: Sun, 2 Nov 2003 14:23:41 -0500
User-agent: Mutt/1.4.1i

On Wed, Oct 29, 2003 at 11:22:01AM -0500, Michael Santos wrote:
> 
> Anyone else seeing fd leaks in cfexecd?
> 
> Version: cfengine 2.0.8p1, db 4.1.25, openssl 0.96g+patches
> 
> Platforms: Solaris 8, NetBSD 1.5.4, Linux (Redhat 7.2/Debian Woody).

Here's an updated patch against cfengine 2.1.0. cfexecd will leave
an fd open, for example, if it cannot contact the SMTP server.

-- 
Michael Santos <address@hidden>
Unix Administrator/MIST Inc.


--- src/cfexecd.c-orig  2003-11-01 19:44:54.000000000 -0500
+++ src/cfexecd.c       2003-11-01 19:43:57.000000000 -0500
@@ -840,4 +840,5 @@
    printf("i.e. www.gnu.org, not just www. If you use NIS or /etc/hosts\n");
    printf("make sure that the full form is registered too as an alias!\n");
+   fclose(fp);
    return;
    }
@@ -846,4 +847,5 @@
    {
    CfLog(cferror,"Unable to lookup smtp service","getservbyname");
+   fclose(fp);
    return;
    }
@@ -858,4 +860,5 @@
    {
    CfLog(cferror,"Couldn't open a socket","socket");
+   fclose(fp);
    return;
    }
@@ -865,4 +868,5 @@
    snprintf(OUTPUT,bufsize*2,"Couldn't connect to host %s\n",VMAILSERVER);
    CfLog(cfinform,OUTPUT,"connect");
+   fclose(fp);
    close(sd);
    return;
@@ -933,4 +937,6 @@
 Dialogue(sd,"QUIT\r\n");
 Debug("Done sending mail\n");
+fclose(fp);
+close(sd); 
 return;
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]