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

List:       kde-commits
Subject:    KDE_3_2_BRANCH: kdepim/kmail
From:       Stephan Kulow <coolo () kde ! org>
Date:       2004-04-29 6:47:27
Message-ID: 20040429064727.7F1A39266 () office ! kde ! org
[Download RAW message or body]

CVS commit by coolo: 

make sure forked children don't inherit kmail's file descriptors
(approved by Ingo)


  M +2 -0      kmfolderindex.cpp   1.15.6.2
  M +5 -0      kmfoldermaildir.cpp   1.79.4.2
  M +6 -0      kmfoldermbox.cpp   1.92.2.2


--- kdepim/kmail/kmfolderindex.cpp  #1.15.6.1:1.15.6.2
@@ -182,4 +182,6 @@ int KMFolderIndex::writeIndex( bool crea
   mIndexStream = fopen(QFile::encodeName(indexName), "r+"); // index file
   assert( mIndexStream );
+  fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
+
   updateIndexStreamPtr();
 

--- kdepim/kmail/kmfoldermaildir.cpp  #1.79.4.1:1.79.4.2
@@ -32,4 +32,6 @@ using KMail::MaildirJob;
 #include <assert.h>
 #include <limits.h>
+#include <unistd.h>
+#include <fcntl.h>
 
 #ifndef MAX_LINE
@@ -105,4 +107,6 @@ int KMFolderMaildir::open()
     } else {
       mIndexStream = fopen(QFile::encodeName(indexLocation()), "r+"); // index file
+      if ( mIndexStream )
+        fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
       updateIndexStreamPtr();
     }
@@ -175,4 +179,5 @@ int KMFolderMaildir::create(bool imap)
 
     if (!mIndexStream) return errno;
+    fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
   }
   else

--- kdepim/kmail/kmfoldermbox.cpp  #1.92.2.1:1.92.2.2
@@ -155,4 +155,8 @@ int KMFolderMbox::open()
   mChanged = false;
 
+  fcntl(fileno(mStream), F_SETFD, FD_CLOEXEC);
+  if (mIndexStream)
+     fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
+
   return rc;
 }
@@ -194,4 +198,5 @@ int KMFolderMbox::create(bool imap)
 
   if (!mStream) return errno;
+  fcntl(fileno(mStream), F_SETFD, FD_CLOEXEC);
 
   if (!path().isEmpty())
@@ -203,4 +208,5 @@ int KMFolderMbox::create(bool imap)
 
     if (!mIndexStream) return errno;
+    fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
   }
   else


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

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