commit cda596d530c697e265d6de2ea66147a31a26c9b6
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sun Sep 27 11:47:45 2015 +0200

    remove legacy (bsd-style) locking
    
    flock() may be implemented via fcntl(), which may cause the process to
    deadlock itself when trying to apply both types of locks. this is the
    case even on linux when the file lives on NFS.
    
    it's unlikely that anything except mbsync would try to access the
    .uidvalidity files anyway, so there is no point in trying to be
    compatible with anything else ...
    
    REFMAIL: uddy4g589ym....@eismej-u14.spgear.lab.emc.com

 src/drv_maildir.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index b9ed463..a94b01f 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -33,15 +33,10 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <sys/file.h>
 #include <errno.h>
 #include <time.h>
 #include <utime.h>
 
-#ifdef __linux__
-# define LEGACY_FLOCK 1
-#endif
-
 #if !defined(_POSIX_SYNCHRONIZED_IO) || _POSIX_SYNCHRONIZED_IO <= 0
 # define fdatasync fsync
 #endif
@@ -550,13 +545,6 @@ maildir_uidval_lock( maildir_store_t *ctx )
                /* The unlock timer is active, so we are obviously already 
locked. */
                return DRV_OK;
        }
-#ifdef LEGACY_FLOCK
-       /* This is legacy only */
-       if (flock( ctx->uvfd, LOCK_EX ) < 0) {
-               error( "Maildir error: cannot flock UIDVALIDITY.\n" );
-               return DRV_BOX_BAD;
-       }
-#endif
        /* This (theoretically) works over NFS. Let's hope nobody else did
           the same in the opposite order, as we'd deadlock then. */
 #if SEEK_SET != 0
@@ -628,10 +616,6 @@ maildir_uidval_unlock( maildir_store_t *ctx )
 #endif /* USE_DB */
        lck.l_type = F_UNLCK;
        fcntl( ctx->uvfd, F_SETLK, &lck );
-#ifdef LEGACY_FLOCK
-       /* This is legacy only */
-       flock( ctx->uvfd, LOCK_UN );
-#endif
 }
 
 static void

------------------------------------------------------------------------------
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to