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

List:       kde-commits
Subject:    KDE/kdepim/akonadi/resources/mbox/libmbox
From:       Bertjan Broeksema <b.broeksema () home ! nl>
Date:       2009-04-04 19:03:30
Message-ID: 1238871810.566113.10286.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 949261 by bbroeksema:

Finish the MBox::open() method and modify the procmail_lock test to ensure that
the mbox file itself is actually locked.


 M  +2 -1      mbox.cpp  
 M  +3 -1      tests/mboxtest.cpp  


--- trunk/KDE/kdepim/akonadi/resources/mbox/libmbox/mbox.cpp #949260:949261
@@ -151,8 +151,9 @@
   if (int rc = lock() != 0)
     return rc;
 
+  fcntl(fileno(d->mStream), F_SETFD, FD_CLOEXEC);
 
-  return 0;
+  return errno;
 }
 
 void MBox::setLockType(LockType ltype)
--- trunk/KDE/kdepim/akonadi/resources/mbox/libmbox/tests/mboxtest.cpp #949260:949261
@@ -105,7 +105,9 @@
     QVERIFY(!QFile(fileName() + ".lock").exists());
     mbox.open();
     QVERIFY(QFile(fileName() + ".lock").exists());
-    mbox.close();
+    QFile file(fileName());
+    QVERIFY(!file.open(QFile::ReadWrite)); // The file should be locked so open
+    mbox.close();                          // should fail.
     QVERIFY(!QFile(fileName() + ".lock").exists());
   } else {
     QVERIFY(!QFile(fileName() + ".lock").exists());
[prev in list] [next in list] [prev in thread] [next in thread] 

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