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

List:       kde-commits
Subject:    kdepim/kmail
From:       Stephan Kulow <coolo () kde ! org>
Date:       2004-04-29 6:48:15
Message-ID: 20040429064815.1F42F9A05 () 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.18
  M +10 -5     kmfoldermaildir.cpp   1.87
  M +8 -1      kmfoldermbox.cpp   1.104


--- kdepim/kmail/kmfolderindex.cpp  #1.17:1.18
@@ -183,4 +183,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.86:1.87
@@ -33,4 +33,6 @@ using KMail::MaildirJob;
 #include <assert.h>
 #include <limits.h>
+#include <unistd.h>
+#include <fcntl.h>
 
 #ifndef MAX_LINE
@@ -106,4 +108,6 @@ int KMFolderMaildir::open()
     } else {
       mIndexStream = fopen(QFile::encodeName(indexLocation()), "r+"); // index file
+      if ( mIndexStream )
+        fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
       updateIndexStreamPtr();
     }
@@ -176,4 +180,5 @@ int KMFolderMaildir::create(bool imap)
 
     if (!mIndexStream) return errno;
+    fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
   }
   else

--- kdepim/kmail/kmfoldermbox.cpp  #1.103:1.104
@@ -156,4 +156,8 @@ int KMFolderMbox::open()
   mChanged = false;
 
+  fcntl(fileno(mStream), F_SETFD, FD_CLOEXEC);
+  if (mIndexStream)
+     fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
+
   return rc;
 }
@@ -196,4 +200,6 @@ int KMFolderMbox::create(bool imap)
   if (!mStream) return errno;
 
+  fcntl(fileno(mStream), F_SETFD, FD_CLOEXEC);
+
   if (!folder()->path().isEmpty())
   {
@@ -204,4 +210,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